[ALF-22060] Reader on the backing store is obtained twice in CachingContentStore Created: 18-Jan-19  Updated: 16-Oct-19  Resolved: 14-Feb-19

Status: Closed
Project: Alfresco
Component/s: Repository
Affects Version/s: 5.2
Fix Version/s: ACS 201910-EA
Security Level: external (External user)

Type: Bug Priority: Minor
Reporter: Nicolas Barithel (Inactive) Assignee: Closed Issues
Resolution: Resolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
shadowed by REPO-4182 Merge ALF-22060: Reader on the backin... Done
Date of First Response:



When using the CachingContentStore and acquiring a reader, the first time a content is needed or if the content is missing from the cache it is obtained from the backing store.

This is expected, but the actual result is that the reader is retrieved twice from the backing store (first time only the size is checked, to ensure quota is not exceeded) which can be improved.

For your reference, here is the list of all invocations:
1. at org.alfresco.repo.content.caching.CachingContentStore.cacheAndRead(CachingContentStore.java:201)
2. at org.alfresco.repo.content.caching.CachingContentStore.attemptCacheAndRead(CachingContentStore.java:264)



Comment by Nicolas Barithel (Inactive) [ 18-Jan-19 ]


Pull request submitted : https://github.com/Alfresco/alfresco-repository/pull/329


Comment by Stefan Kopf [ 21-Jan-19 ]

Closed PR and left a long comment there.

When a store is asked for a Reader, it should not perform any operations and immediately return a java object implementing the ContentReader interface. This implementation should not perform any operations until it is actually asked to do so.

The CachingContentStore is not about caching the ContentReader object. It is about caching the actual binary content.

Comment by Nicolas Barithel (Inactive) [ 21-Jan-19 ]

Hi Stefan,

Detailed explanation provided in the PR. It should clarify the goal and why it does not change the current behavior.


Comment by Stefan Kopf [ 04-Feb-19 ]

I had a look into the PR again. I missed the point that the .put() into the cache actually copies the bytes. We will put this in the queue to be reviewed and merged.

Comment by Erik Knizat [ 14-Feb-19 ]

Merged the PR

Generated at Fri Sep 25 18:08:25 BST 2020 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.