From 2d848f98c95c6a2566d1f46ffb6c526218fad348 Mon Sep 17 00:00:00 2001 From: Eva Vasques Date: Thu, 2 Jun 2022 10:18:20 +0100 Subject: [PATCH] MNT-23022 - change scope of idInIndex so we can use it to verify as the last id evaluated if the fix operation was complete --- .../org/alfresco/solr/SolrInformationServer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java index a574cbb6e..6af6c1036 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/SolrInformationServer.java @@ -3691,7 +3691,7 @@ public class SolrInformationServer implements InformationServer IOpenBitSet idsInIndex = this.getOpenBitSetInstance(); long batchStartId = minId; long batchEndId = Math.min(batchStartId + BATCH_FACET_TXS, maxId); - long lastIdEvaluated = 0; + long idInIndex = 0L; // Continues as long as the batch does not pass the maximum while (batchStartId <= maxId) @@ -3702,8 +3702,7 @@ public class SolrInformationServer implements InformationServer field, 1); // Min count of 1 ensures that the id returned is in the index for (Map.Entry idCount : idCounts) { - long idInIndex = Long.parseLong(idCount.getKey()); - lastIdEvaluated = idInIndex; + idInIndex = Long.parseLong(idCount.getKey()); // Only looks at facet values that fit the query if (batchStartId <= idInIndex && idInIndex <= batchEndId) @@ -3744,22 +3743,22 @@ public class SolrInformationServer implements InformationServer } // Verify we processed all items from request params, if not, send a warning - if (lastIdEvaluated != 0 && lastIdEvaluated < batchEndId) + if (idInIndex != 0L && idInIndex < batchEndId) { try { - AclChangeSets changesets = repositoryClient.getAclChangeSets(null, lastIdEvaluated, null, lastIdEvaluated + 1, + AclChangeSets changesets = repositoryClient.getAclChangeSets(null, idInIndex, null, idInIndex + 1, 1); Long changeSetCommitTimeMs = changesets.getAclChangeSets().size() > 0 ? changesets.getAclChangeSets().get(0).getCommitTimeMs() : 0L; LOGGER.warning("Not all items processed. Last acl changeset (id {} ) with commit time evaluated: {}", - lastIdEvaluated, changeSetCommitTimeMs); + idInIndex, changeSetCommitTimeMs); } catch (JSONException | AuthenticationException | IOException e) { - LOGGER.warning("Not all items processed. Last acl changeset evaluated: {}", lastIdEvaluated); + LOGGER.warning("Not all items processed. Last acl changeset evaluated: {}", idInIndex); } }