Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.0/Cloud)

86231: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      86156: Merged DEV to V4.2-BUG-FIX (4.2.4)
         86145 : MNT-11758 : Starting Alfresco with Centera as the main content store, with content store caching enabled, generates errors
            - We should recache content if content url was changed after write operation (like centera or xam)
            - Unit test was added.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94528 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 09:44:55 +00:00
parent cf29d5fec8
commit 9d7c30289a
4 changed files with 153 additions and 1 deletions

View File

@@ -273,9 +273,16 @@ public class CachingContentStore implements ContentStore, ApplicationEventPublis
bsWriter.setLocale(cacheWriter.getLocale());
bsWriter.setMimetype(cacheWriter.getMimetype());
bsWriter.putContent(cacheWriter.getReader());
boolean contentUrlChanged = !url.equals(bsWriter.getContentUrl());
if (!quota.afterWritingCacheFile(cacheWriter.getSize()))
// MNT-11758 fix, re-cache files for which content url has changed after write to backing store (e.g. XAM, Centera)
if (!quota.afterWritingCacheFile(cacheWriter.getSize()) || contentUrlChanged)
{
if (contentUrlChanged)
{
// MNT-11758 fix, cache file with new and correct contentUrl after write operation to backing store completed
cache.put(bsWriter.getContentUrl(), cacheWriter.getReader());
}
// Quota manager has requested that the new cache file is not kept.
cache.deleteFile(url);
cache.remove(url);