Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)

113291 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
      113279 adavis: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.6)
         113102 amorarasu: MNT-10305: DeletedNodeCleanupWorker should be improved.
            - Moved the retrying transaction helper declaration back in the while loop - fix test attempt.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@113398 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tatyana Valkevych
2015-09-30 09:49:51 +00:00
parent cb1d757f4b
commit c43c91e37c

View File

@@ -104,16 +104,16 @@ public class DeletedNodeCleanupWorker extends AbstractNodeCleanupWorker
final long maxCommitTime = System.currentTimeMillis() - minAge;
long fromCommitTime = nodeDAO.getMinUnusedTxnCommitTime().longValue();
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setMaxRetries(5); // Limit number of retries
txnHelper.setRetryWaitIncrementMs(1000); // 1 second to allow other cleanups time to get through
long loopPurgeSize = purgeSize;
Long purgeCount = new Long(0);
while (true)
{
// Ensure we keep the lock
refreshLock();
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setMaxRetries(5); // Limit number of retries
txnHelper.setRetryWaitIncrementMs(1000); // 1 second to allow other cleanups time to get through
long toCommitTime = fromCommitTime + loopPurgeSize;
if(toCommitTime > maxCommitTime)
@@ -212,16 +212,16 @@ public class DeletedNodeCleanupWorker extends AbstractNodeCleanupWorker
final long maxCommitTime = System.currentTimeMillis() - minAge;
long fromCommitTime = nodeDAO.getMinUnusedTxnCommitTime().longValue();
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setMaxRetries(5); // Limit number of retries
txnHelper.setRetryWaitIncrementMs(1000); // 1 second to allow other cleanups time to get through
// delete unused transactions in batches of size 'purgeTxnBlockSize'
while (true)
{
// Ensure we keep the lock
refreshLock();
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setMaxRetries(5); // Limit number of retries
txnHelper.setRetryWaitIncrementMs(1000); // 1 second to allow other cleanups time to get through
long toCommitTime = fromCommitTime + purgeSize;
if(toCommitTime >= maxCommitTime)
@@ -231,7 +231,7 @@ public class DeletedNodeCleanupWorker extends AbstractNodeCleanupWorker
// Purge transactions
try
{
{
DeleteTransactionsCallback purgeTxnsCallback = new DeleteTransactionsCallback(nodeDAO, fromCommitTime, toCommitTime);
long purgeCount = txnHelper.doInTransaction(purgeTxnsCallback, false, true);
if (purgeCount > 0)