mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-17 14:21:20 +00:00
Merge pull request #1359 from Alfresco/fix/MNT-22802_DB_ID_RANGE_idle_shard_fix_20x
Only add the latest transaction if not indexed when shard out of range
This commit is contained in:
@@ -808,7 +808,7 @@ public class MetadataTracker extends ActivatableTracker
|
|||||||
{
|
{
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"{}-[CORE {}] [DB_ID_RANGE] Last commit time is greater that max commit time in in range [{}-{}]. "
|
"{}-[CORE {}] [DB_ID_RANGE] Last commit time is greater that max commit time in in range [{}-{}]. "
|
||||||
+ "Indexing only latest transaction.",
|
+ "Indexing only latest transaction if necessary.",
|
||||||
Thread.currentThread().getId(), coreName, dbIdRangeRouter.getStartRange(),
|
Thread.currentThread().getId(), coreName, dbIdRangeRouter.getStartRange(),
|
||||||
dbIdRangeRouter.getEndRange());
|
dbIdRangeRouter.getEndRange());
|
||||||
shardOutOfRange = true;
|
shardOutOfRange = true;
|
||||||
@@ -832,10 +832,19 @@ public class MetadataTracker extends ActivatableTracker
|
|||||||
Transaction latestTransaction = new Transaction();
|
Transaction latestTransaction = new Transaction();
|
||||||
latestTransaction.setCommitTimeMs(transactions.getMaxTxnCommitTime());
|
latestTransaction.setCommitTimeMs(transactions.getMaxTxnCommitTime());
|
||||||
latestTransaction.setId(transactions.getMaxTxnId());
|
latestTransaction.setId(transactions.getMaxTxnId());
|
||||||
transactions = new Transactions(
|
|
||||||
Collections.singletonList(latestTransaction),
|
if (!isTransactionIndexed(latestTransaction))
|
||||||
transactions.getMaxTxnCommitTime(),
|
{
|
||||||
|
transactions = new Transactions(Collections.singletonList(latestTransaction), transactions.getMaxTxnCommitTime(),
|
||||||
transactions.getMaxTxnId());
|
transactions.getMaxTxnId());
|
||||||
|
LOGGER.debug("{}:{}-[CORE {}] [DB_ID_RANGE] Latest transaction to be indexed {}",
|
||||||
|
Thread.currentThread().getId(), coreName, latestTransaction);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// All up do date, don't return transactions
|
||||||
|
return new Transactions(Collections.emptyList(), 0L, 0L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return transactions;
|
return transactions;
|
||||||
|
Reference in New Issue
Block a user