Build fix - fix build speed

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19538 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2010-03-24 13:59:15 +00:00
parent 174fd8fd77
commit 7f4810c32d

View File

@@ -183,38 +183,16 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
transactionService.setAllowWrite(false); transactionService.setAllowWrite(false);
} }
int startSample = 10;
InIndex startAllPresent;
do
{
// Check that the first and last meaningful transactions are indexed
List<Transaction> startTxns = nodeDaoService.getTxnsByCommitTimeAscending(
Long.MIN_VALUE, Long.MAX_VALUE, startSample, null, false);
startAllPresent = areTxnsInStartSample(startTxns);
startSample += 10;
if(startSample > 1000)
{
startAllPresent = InIndex.NO;
break;
}
}
while(startAllPresent == InIndex.INDETERMINATE);
int endSample = 10; List<Transaction> startTxns = nodeDaoService.getTxnsByCommitTimeAscending(
InIndex endAllPresent; Long.MIN_VALUE, Long.MAX_VALUE, 1000, null, false);
do InIndex startAllPresent = areTxnsInStartSample(startTxns);
{
List<Transaction> endTxns = nodeDaoService.getTxnsByCommitTimeDescending( List<Transaction> endTxns = nodeDaoService.getTxnsByCommitTimeDescending(
Long.MIN_VALUE, Long.MAX_VALUE, endSample, null, false); Long.MIN_VALUE, Long.MAX_VALUE, 1000, null, false);
endAllPresent = areAllTxnsInEndSample(endTxns); InIndex endAllPresent = areAllTxnsInEndSample(endTxns);
endSample += 10;
if(endSample > 1000)
{
endAllPresent = InIndex.NO;
break;
}
}
while(endAllPresent == InIndex.INDETERMINATE);
// check the level of cover required // check the level of cover required
switch (recoveryMode) switch (recoveryMode)
@@ -256,9 +234,11 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
*/ */
protected InIndex areAllTxnsInEndSample(List<Transaction> txns) protected InIndex areAllTxnsInEndSample(List<Transaction> txns)
{ {
int count = 0;
int yesCount = 0; int yesCount = 0;
for (Transaction txn : txns) for (Transaction txn : txns)
{ {
count++;
if (isTxnPresentInIndex(txn) == InIndex.NO) if (isTxnPresentInIndex(txn) == InIndex.NO)
{ {
// Missing txn // Missing txn
@@ -267,30 +247,33 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
if (isTxnPresentInIndex(txn) == InIndex.YES) if (isTxnPresentInIndex(txn) == InIndex.YES)
{ {
yesCount++; yesCount++;
} if((yesCount > 1) && (count >= 10))
}
// Work around for TX that is written to the repo at start up .. must be more than one real add /update
if(yesCount > 1)
{ {
return InIndex.YES; return InIndex.YES;
} }
else
{
return InIndex.INDETERMINATE;
} }
} }
return InIndex.INDETERMINATE;
}
protected InIndex areTxnsInStartSample(List<Transaction> txns) protected InIndex areTxnsInStartSample(List<Transaction> txns)
{ {
int count = 0;
InIndex current = InIndex.INDETERMINATE; InIndex current = InIndex.INDETERMINATE;
for (Transaction txn : txns) for (Transaction txn : txns)
{ {
count++;
current = isTxnPresentInIndex(txn); current = isTxnPresentInIndex(txn);
if (current == InIndex.NO) if (current == InIndex.NO)
{ {
// Missing txn // Missing txn
return InIndex.NO; return InIndex.NO;
} }
if((current == InIndex.YES) && (count >= 10))
{
return InIndex.YES;
}
} }
return current; return current;
} }