[MGNLADVCACHE-97] NotifyFlushListeningPolicy flushes persistent cache on restart entirely Created: 08/May/18  Updated: 28/Mar/19

Status: Open
Project: Advanced Cache
Component/s: core
Affects Version/s: 1.8.2, 1.9
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: Vivian Steller Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Due to a missing slash, Magnolia does not determine the lastUpdateTimestamp of the cache correctly, which leads to an entire cache clear at module (re-)start.

Here's the relevant code snippet:

https://git.magnolia-cms.com/projects/ENTERPRISE/repos/advanced-cache/browse/magnolia-advanced-cache/src/main/java/info/magnolia/module/advancedcache/NotifyFlushListeningPolicy.java#138

                if (!session.propertyExists(path + TIMESTAMP)) {
                    cache.clear();
                    timestamp = System.currentTimeMillis();
                } else {
                    timestamp = session.getProperty(path + TIMESTAMP).getLong();
                } 

Path, which is something like /NotifyFlushListeningPolicy/defaultPageCache is concatenated with lastUpdateTimeStamp and this leads to property lookup like /NotifyFlushListeningPolicy/defaultPageCachelastUpdateTimeStamp which obviously isn't a correct path. There's a slash missing right before lastUpdateTimeStamp.

The consequence of this is, that even a persistent cache is flushed entirely upon restart.

Please patch the code with:

                if (!session.propertyExists(path + "/" + TIMESTAMP)) {
                    cache.clear();
                    timestamp = System.currentTimeMillis();
                } else {
                    timestamp = session.getProperty(path + "/" + TIMESTAMP).getLong();
                } 


 Comments   
Comment by Andrew Warinner [ 08/May/18 ]

A suggestion: it would be nice if this was fixed in the 1.8 branch for Magnolia 5.5 as well.

Generated at Sun Feb 11 23:10:59 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.