From f03e2b4edc7391b550de8a647a2501c634a7d1aa Mon Sep 17 00:00:00 2001 From: Angel Borroy Date: Wed, 19 Aug 2020 09:32:40 +0200 Subject: [PATCH] SEARCH-2390: Skip getting nodes from repository when no transactions left --- .../org/alfresco/solr/tracker/MetadataTracker.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java index cbccb83c0..718414413 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/tracker/MetadataTracker.java @@ -1052,7 +1052,9 @@ private void indexTransactionsAfterWorker(List txsIndexed) * @throws JSONException */ private int indexBatchOfTransactions(List txBatch) - throws AuthenticationException, IOException, JSONException, ExecutionException, InterruptedException { + throws AuthenticationException, IOException, JSONException, ExecutionException, InterruptedException + { + // Skip transactions without modifications (updates, deletes) ArrayList txIds = new ArrayList<>(); for (Transaction tx : txBatch) @@ -1062,7 +1064,13 @@ private int indexBatchOfTransactions(List txBatch) txIds.add(tx.getId()); } } - + + // Skip getting nodes when no transactions left + if (txIds.size() == 0) + { + return 0; + } + // Get Nodes Id properties for every transaction GetNodesParameters gnp = new GetNodesParameters(); gnp.setTransactionIds(txIds);