mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
74021: Merged DEV 5.0 to HEAD-BUG-FIX (5.0) r73999: ACE-1979: BM-0015: S3 AWS error messages generated during load tests - Emptying tag scope cache has been changed to setting content property for the cache to null to avoid zero-size writes. New test has been added for 'UpdateTagScopesActionExecuter' which covers use-case described in point 4. The fix has been tested against 'TaggingServiceImplTest' git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74867 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -439,30 +439,44 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = contentService.getWriter(tagScopeNode, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
|
||||
|
||||
// ACE-1979: emptying tag scope cache by setting content property for the cache to null to avoid zero-size writes. Orphaned content will be deleted with content store
|
||||
// cleaner job
|
||||
if (tags.isEmpty())
|
||||
{
|
||||
nodeService.setProperty(tagScopeNode, ContentModel.PROP_TAGSCOPE_CACHE, null);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Updated tag scope: '" + tagScopeNode + "'. No tags were found. Emptying tags cache by setting content property to null...");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = contentService.getWriter(tagScopeNode, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
|
||||
// Log this if required
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Updated tag scope " + tagScopeNode + " with " + updates + ", " +
|
||||
"new contents are { " + tagContent.replace("\n", " : ") + " } " +
|
||||
"from old contents of " + previousTagState
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// We're done making our changes
|
||||
// Allow behaviours to fire again if they want to
|
||||
behaviourFilter.enableBehaviour();
|
||||
|
||||
// Log this if required
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Updated tag scope " + tagScopeNode + " with " + updates + ", " +
|
||||
"new contents are { " + tagContent.replace("\n", " : ") + " } " +
|
||||
"from old contents of " + previousTagState
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user