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.

This commit is contained in:
Angel Borroy
2020-02-25 09:28:13 +01:00
parent 401d3300be
commit 29b53b55bd
2 changed files with 10 additions and 19 deletions
@@ -22,7 +22,6 @@ import javax.json.Json;
import javax.json.JsonObject; import javax.json.JsonObject;
import org.alfresco.dataprep.SiteService.Visibility; import org.alfresco.dataprep.SiteService.Visibility;
import org.alfresco.rest.requests.Site;
import org.alfresco.rest.search.SearchResponse; import org.alfresco.rest.search.SearchResponse;
import org.alfresco.test.search.functional.AbstractE2EFunctionalTest; import org.alfresco.test.search.functional.AbstractE2EFunctionalTest;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
@@ -2249,15 +2249,11 @@ public class SolrInformationServer implements InformationServer
String errorDocId = PREFIX_ERROR + node.getId(); String errorDocId = PREFIX_ERROR + node.getId();
// Try finding the node before performing removal operation // SEARCH-2096: Try finding the node before performing removal operation fails on some race conditions
DocSet docSet = request.getSearcher().getDocSet(new TermQuery(new Term(FIELD_SOLR4_ID, errorDocId))); // This is why the approach was removed before identifying these conditions
DeleteUpdateCommand delErrorDocCmd = new DeleteUpdateCommand(request);
if (docSet.size() > 0) delErrorDocCmd.setId(errorDocId);
{ processor.processDelete(delErrorDocCmd);
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 private void deleteNode(UpdateRequestProcessor processor, SolrQueryRequest request, long dbid) throws IOException
{ {
// Try finding the node before performing removal operation // SEARCH-2096: Try finding the node before performing removal operation fails on some race conditions
DocSet docSet = request.getSearcher().getDocSet(LongPoint.newExactQuery(FIELD_DBID, dbid)); // This is why the approach was removed before identifying these conditions
DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request);
if (docSet.size() > 0) delDocCmd.setQuery(FIELD_DBID + ":" + dbid);
{ processor.processDelete(delDocCmd);
DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request);
delDocCmd.setQuery(FIELD_DBID + ":" + dbid);
processor.processDelete(delDocCmd);
}
} }