Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pages] Removing contents from containers does not refresh cache #12716

Closed
joseorsini opened this issue Oct 2, 2017 · 15 comments
Closed

[Pages] Removing contents from containers does not refresh cache #12716

joseorsini opened this issue Oct 2, 2017 · 15 comments

Comments

@joseorsini
Copy link
Contributor

joseorsini commented Oct 2, 2017

Expected Behavior

After a content is removed from a container, Behavior of pages on Edit/Preview/Mode should reflect this latest update and never show the content that was recently removed.

Current Behavior

If we remove a content from a container, the recently removed content is still displayed in the same page on Live Mode. Edit/Preview mode shows the right behavior. Even if we set the page Cache TTL to zero, or if we set ?dotcache=no/refresh on the URI, the page is not refreshed.

Possible Solution

Update/Invalidate the live-version cached objects for this page and associated contents.

Known Workarounds

Flush all caches.

Steps to Reproduce (for bugs)

  1. Create a test page, using any template. Save/Publish it.
  2. Add a live content to any of its containers.
  3. Check the page on Live/Preview/Edit mode. Content is added to the container. Add the page on a different browser and check that the content is displayed there as well.
  4. On Edit Mode, remove the content you added from the container.
  5. Switch to Preview and Live Mode.
    • Preview mode doesn't show the content that was removed.
    • Live mode does.
  6. Check the same page on a different browser, without logging in to the backend. Content still shows up on the page.

Context

Reported on latest master and on dotCMS 4.1.1, according to customer's instructions here
https://dotcms.zendesk.com/agent/tickets/90583

Screencast: https://drive.google.com/file/d/0B48uh-u7fegRRVZ5T3BSb0VZMHM/view?usp=sharing

Your Environment

  • dotCMS version used: current master, 4.1.1.
  • Browser Name and version: Any OS.
  • Operating System and version: Any OS.
  • Application Server and version: Tomcat 8.0.18
  • Java Brand and version: Java 8u121.
  • Database and version: Postgres, H2.
  • Application module (if apply): N/A
@joseorsini
Copy link
Contributor Author

Issue happens also if a content was recently removed and then it's added back to the same container.

@joseorsini
Copy link
Contributor Author

Typo on branch name and committed message. Fix is here 3387de6

@joseorsini
Copy link
Contributor Author

PR for Master: #12720

@joseorsini
Copy link
Contributor Author

PR for Release-4.2: #12721

joseorsini added a commit that referenced this issue Oct 2, 2017
joseorsini added a commit that referenced this issue Oct 3, 2017
joseorsini added a commit that referenced this issue Oct 3, 2017
joseorsini added a commit that referenced this issue Oct 3, 2017
joseorsini added a commit that referenced this issue Oct 3, 2017
@john-thomas-dotcms
Copy link
Contributor

@joseorsini I'm assuming there was a real issue here, but note that in your original steps to reproduce the behavior looks like it's correct - since you didn't save/publish the page between steps 4 and 5, the content should no longer show in the preview mode (which shows you what the page will look like if you publish the page), but should still show in the live mode (since you haven't published the changes you made yet). The content you remove shouldn't disappear from the Live version of the page until you save/publish the page.

@joseorsini
Copy link
Contributor Author

@john-thomas-dotcms I believe an update in the MultiTree relationships here wouldn't require the user to manually publish a page here. We would expect that the MultiTree relationship (which is not versionable) is refreshed on cache, because once a content is added/removed from a container, the relationships are already updated in the DB side of things. It was just a matter of invalidating cache here, and user does not have to go and publish the page manually, reducing the amount of steps to do in order to see an updated version of the page they're editing.

@john-thomas-dotcms
Copy link
Contributor

john-thomas-dotcms commented Oct 5, 2017

@joseorsini if they don't have to publish the page for the changes to go live, then:
A. What is the point of having the publish option for the page?
B. What is the point of having Preview vs. Live modes on the page?

I think that it's intuitive and maybe necessary that adding a content to a page in the page editor does not automatically publish the changes. Part of the goal of the Preview mode is to allow users to see what their changes will look like if they do publish it.

And what happens if the user adding the content to the page has edit permissions for the page but not publish permissions for it? Maybe I'm not understanding something here, , but it seems wrong on a few different levels to publish the changes immediately (without the user explicitly taking the publish action).

jgambarios pushed a commit that referenced this issue Oct 25, 2017
* issue #12176 invalidate page cache once multitree is updated

* issue #12716 remove unused import

* issue #12716 add suggestions discussed with devs

* rework on #12716

* rework on #12716

* rework on #12716

* rework on #12716
@bryanboza
Copy link
Contributor

This fix is broken some unit test...

@jgambarios jgambarios added this to the Cody Current milestone Oct 27, 2017
@oswaldogallango
Copy link

P.R #12946

@jgambarios jgambarios added this to the Cody Next milestone Nov 6, 2017
@joseorsini
Copy link
Contributor Author

A question: this NPE is triggered by the time contents are being destroyed, however, the MultiTreeFactory.deleteMultiTree call is done by the time:

  • Contents are archived.
  • Contents still have a valid version info.

Since Language and Id are values that are persisting in contents, and content is not fully deleted yet, why it returns a null VersionInfo for these contents?

@joseorsini
Copy link
Contributor Author

New issues surfaced during tests, in order to reproduce issues reported by regression tests. Reported under

#12999

dsilvam added a commit that referenced this issue Nov 16, 2017
wezell added a commit that referenced this issue Nov 17, 2017
wezell added a commit that referenced this issue Nov 17, 2017
wezell added a commit that referenced this issue Nov 17, 2017
dsilvam added a commit that referenced this issue Nov 17, 2017
dsilvam added a commit that referenced this issue Nov 17, 2017
#13076)

* #12716 Update version_ts for all page versions. Refresh all page versions from cache.

* #12716 something like this

* #12716 something like this - unteseted

* #12716 something like this - unteseted

* #12716 rename variable.
@dsilvam dsilvam modified the milestones: Cody Current, Rex Current Nov 17, 2017
dsilvam added a commit that referenced this issue Nov 17, 2017
dsilvam added a commit that referenced this issue Nov 17, 2017
* #12716 Update version_ts for all page versions. Refresh all page versions from cache.

* #12716 something like this

* #12716 something like this - unteseted

* #12716 something like this - unteseted

* #12716 rename variable.

* #12716 Missing class.
@dsilvam dsilvam modified the milestones: Rex Current, Rex Next Dec 5, 2017
@bryanboza
Copy link
Contributor

Fixed, tested in the last master // postgres // FF

@shaydotcms
Copy link

Passed QA.
Upgrade from dotcms_3.6 to master branch
Ubuntu 14.04.1 / Postgres 9.6 / Chrome v54.0.2840.98 / Tomcat 8 / Java 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants