From c98fa19d334f067a8653c72ccc774217b6aa3ec6 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Tue, 8 Oct 2013 13:21:54 +0000 Subject: [PATCH] SOLR-5314: Shard split action should use soft commits instead of hard commits to make sub shard data visible git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1530267 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../solr/cloud/OverseerCollectionProcessor.java | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index a234ebea8bf..63175f224b7 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -115,6 +115,9 @@ Bug Fixes * SOLR-5305: Admin UI - Reloading System-Information on Dashboard does not work anymore (steffkes) +* SOLR-5314: Shard split action should use soft commits instead of hard commits + to make sub shard data visible. (Kalle Aaltonen, shalin) + Security ---------------------- diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java index 7c173f0cefe..bd37bb0bed2 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java @@ -699,16 +699,17 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread { collectShardResponses(results, true, "SPLTSHARD failed to create subshard replicas or timed out waiting for them to come up"); + log.info("Calling soft commit to make sub shard updates visible"); String coreUrl = new ZkCoreNodeProps(parentShardLeader).getCoreUrl(); // HttpShardHandler is hard coded to send a QueryRequest hence we go direct // and we force open a searcher so that we have documents to show upon switching states UpdateResponse updateResponse = null; try { - updateResponse = commit(coreUrl, true); + updateResponse = softCommit(coreUrl); processResponse(results, null, coreUrl, updateResponse, slice); } catch (Exception e) { processResponse(results, e, coreUrl, updateResponse, slice); - throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to call distrib commit on: " + coreUrl, e); + throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to call distrib softCommit on: " + coreUrl, e); } log.info("Successfully created all replica shards for all sub-slices " @@ -735,16 +736,15 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread { } } - static UpdateResponse commit(String url, boolean openSearcher) throws SolrServerException, IOException { + static UpdateResponse softCommit(String url) throws SolrServerException, IOException { HttpSolrServer server = null; try { server = new HttpSolrServer(url); server.setConnectionTimeout(30000); - server.setSoTimeout(60000); + server.setSoTimeout(120000); UpdateRequest ureq = new UpdateRequest(); ureq.setParams(new ModifiableSolrParams()); - ureq.getParams().set(UpdateParams.OPEN_SEARCHER, openSearcher); - ureq.setAction(AbstractUpdateRequest.ACTION.COMMIT, false, true); + ureq.setAction(AbstractUpdateRequest.ACTION.COMMIT, false, true, true); return ureq.process(server); } finally { if (server != null) {