From 29b53b55bd3df86ed31cee8e44c4fcc8926722a4 Mon Sep 17 00:00:00 2001 From: Angel Borroy Date: Tue, 25 Feb 2020 09:28:13 +0100 Subject: [PATCH] SEARCH-2096: Remove SEARCH-2027 approach to delete SOLR Documents only when they existed, as it has been detected some race conditions that lead to duplicating documents in the index. --- .../search/SearchPermissionsTest.java | 1 - .../alfresco/solr/SolrInformationServer.java | 28 +++++++------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchPermissionsTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchPermissionsTest.java index 62dc9ba69..763322842 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchPermissionsTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchPermissionsTest.java @@ -22,7 +22,6 @@ import javax.json.Json; import javax.json.JsonObject; import org.alfresco.dataprep.SiteService.Visibility; -import org.alfresco.rest.requests.Site; import org.alfresco.rest.search.SearchResponse; import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; import org.alfresco.utility.constants.UserRole; 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 e88a75d31..0dbce72f2 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 @@ -2249,15 +2249,11 @@ public class SolrInformationServer implements InformationServer String errorDocId = PREFIX_ERROR + node.getId(); - // Try finding the node before performing removal operation - DocSet docSet = request.getSearcher().getDocSet(new TermQuery(new Term(FIELD_SOLR4_ID, errorDocId))); - - if (docSet.size() > 0) - { - DeleteUpdateCommand delErrorDocCmd = new DeleteUpdateCommand(request); - delErrorDocCmd.setId(errorDocId); - processor.processDelete(delErrorDocCmd); - } + // SEARCH-2096: Try finding the node before performing removal operation fails on some race conditions + // This is why the approach was removed before identifying these conditions + DeleteUpdateCommand delErrorDocCmd = new DeleteUpdateCommand(request); + delErrorDocCmd.setId(errorDocId); + processor.processDelete(delErrorDocCmd); } @@ -2273,15 +2269,11 @@ public class SolrInformationServer implements InformationServer private void deleteNode(UpdateRequestProcessor processor, SolrQueryRequest request, long dbid) throws IOException { - // Try finding the node before performing removal operation - DocSet docSet = request.getSearcher().getDocSet(LongPoint.newExactQuery(FIELD_DBID, dbid)); - - if (docSet.size() > 0) - { - DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request); - delDocCmd.setQuery(FIELD_DBID + ":" + dbid); - processor.processDelete(delDocCmd); - } + // SEARCH-2096: Try finding the node before performing removal operation fails on some race conditions + // This is why the approach was removed before identifying these conditions + DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request); + delDocCmd.setQuery(FIELD_DBID + ":" + dbid); + processor.processDelete(delDocCmd); }