Merge pull request #906 from Alfresco/fix/SEARCH-2390_NoTransactionsDbIdRange

SEARCH-2390: Skip getting nodes from repository when no transactions …
This commit is contained in:
Angel Borroy
2020-08-19 10:58:16 +02:00
committed by GitHub

View File

@@ -1052,7 +1052,9 @@ public class MetadataTracker extends ActivatableTracker
* @throws JSONException * @throws JSONException
*/ */
private int indexBatchOfTransactions(List<Transaction> txBatch) private int indexBatchOfTransactions(List<Transaction> txBatch)
throws AuthenticationException, IOException, JSONException, ExecutionException, InterruptedException { throws AuthenticationException, IOException, JSONException, ExecutionException, InterruptedException
{
// Skip transactions without modifications (updates, deletes) // Skip transactions without modifications (updates, deletes)
ArrayList<Long> txIds = new ArrayList<>(); ArrayList<Long> txIds = new ArrayList<>();
for (Transaction tx : txBatch) for (Transaction tx : txBatch)
@@ -1062,7 +1064,13 @@ public class MetadataTracker extends ActivatableTracker
txIds.add(tx.getId()); txIds.add(tx.getId());
} }
} }
// Skip getting nodes when no transactions left
if (txIds.size() == 0)
{
return 0;
}
// Get Nodes Id properties for every transaction // Get Nodes Id properties for every transaction
GetNodesParameters gnp = new GetNodesParameters(); GetNodesParameters gnp = new GetNodesParameters();
gnp.setTransactionIds(txIds); gnp.setTransactionIds(txIds);