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 7991889a6..f8f617118 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 @@ -296,6 +296,8 @@ public class SolrInformationServer implements InformationServer private String skippingDocsQueryString; private boolean isSkippingDocsInitialized; + private long maxAllowedTimeForAcquiringDbIdLock; + protected enum FTSStatus {New, Dirty, Clean} static class DocListCollector implements Collector, LeafCollector @@ -461,6 +463,8 @@ public class SolrInformationServer implements InformationServer holeRetention = Integer.parseInt(p.getProperty("alfresco.hole.retention", "3600000")); minHash = Boolean.parseBoolean(p.getProperty("alfresco.fingerprint", "true")); + maxAllowedTimeForAcquiringDbIdLock = Long.parseLong(p.getProperty("alfresco.tracker.maxNodeLockMs", "120000")); + dataModel = AlfrescoSolrDataModel.getInstance(); contentStreamLimit = Integer.parseInt(p.getProperty("alfresco.contentStreamLimit", "10000000")); @@ -3182,9 +3186,9 @@ public class SolrInformationServer implements InformationServer // I don't think we are concerned with this exception. } - if (System.currentTimeMillis() - startTime > 120000) + if (System.currentTimeMillis() - startTime > maxAllowedTimeForAcquiringDbIdLock) { - throw new AlfrescoLockException("Unable to acquire lock on nodeId " + id + " after " + 120000 + " msecs."); + throw new AlfrescoLockException("Unable to acquire lock on nodeId " + id + " after " + maxAllowedTimeForAcquiringDbIdLock + " msecs."); } } } diff --git a/search-services/alfresco-search/src/main/resources/solr/instance/templates/rerank/conf/solrcore.properties b/search-services/alfresco-search/src/main/resources/solr/instance/templates/rerank/conf/solrcore.properties index 1d33062d9..b9771edb8 100644 --- a/search-services/alfresco-search/src/main/resources/solr/instance/templates/rerank/conf/solrcore.properties +++ b/search-services/alfresco-search/src/main/resources/solr/instance/templates/rerank/conf/solrcore.properties @@ -30,6 +30,8 @@ alfresco.hole.check.after=300000 alfresco.batch.count=5000 alfresco.recordUnindexedNodes=false +# max time (in msecs) a given tracker instance will try to acquire a lock on a given DBID +alfresco.tracker.maxNodeLockMs=120000 # encryption # none, https diff --git a/search-services/alfresco-solrclient-lib/src/main/java/org/alfresco/solr/client/SOLRAPIClient.java b/search-services/alfresco-solrclient-lib/src/main/java/org/alfresco/solr/client/SOLRAPIClient.java index d5cec7812..760eba485 100644 --- a/search-services/alfresco-solrclient-lib/src/main/java/org/alfresco/solr/client/SOLRAPIClient.java +++ b/search-services/alfresco-solrclient-lib/src/main/java/org/alfresco/solr/client/SOLRAPIClient.java @@ -1587,58 +1587,6 @@ public class SOLRAPIClient public void close() { repositoryHttpClient.close(); - executor.shutdown(); - } - - final ExecutorService executor = Executors.newSingleThreadExecutor(); - - private JSONObject callRepositoryWithTimeout(String msgId, Request req) throws IOException, AuthenticationException, InterruptedException, TimeoutException, ExecutionException { - List> result = executor.invokeAll(singletonList(() -> { - Response response = null; - LookAheadBufferedReader reader = null; - JSONObject json; - try - { - response = repositoryHttpClient.sendRequest(req); - if (response.getStatus() != HttpStatus.SC_OK) - { - throw new AlfrescoRuntimeException(msgId + " return status:" + response.getStatus()); - } - - reader = new LookAheadBufferedReader(new InputStreamReader(response.getContentAsStream(), StandardCharsets.UTF_8), LOGGER); - json = new JSONObject(new JSONTokener(reader)); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(json.toString(3)); - } - return json; - } - catch (JSONException exception) - { - String message = "Received a malformed JSON payload. Request was \"" + - req.getFullUri() + - "Data: " - + ofNullable(reader) - .map(LookAheadBufferedReader::lookAheadAndGetBufferedContent) - .orElse("Not available"); - LOGGER.error(message); - throw exception; - } - finally - { - ofNullable(response).ifPresent(Response::release); - ofNullable(reader).ifPresent(this::silentlyClose); - } - }), 5, TimeUnit.SECONDS); - - Future response = result.iterator().next(); - if(response.isCancelled()) - { - throw new TimeoutException("Request " + req + "has timed out. It has taken more than 5 seconds to respond"); - } - - return response.get(); } private JSONObject callRepository(String msgId, Request req) throws IOException, AuthenticationException