lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject lucene-solr:master: SOLR-9455: Deleting a sub-shard in recovery state can mark parent shard as inactive
Date Mon, 29 Aug 2016 18:31:28 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 757c245be -> 2700b9521


SOLR-9455: Deleting a sub-shard in recovery state can mark parent shard as inactive


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2700b952
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2700b952
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2700b952

Branch: refs/heads/master
Commit: 2700b952119feb2d53a163d3374f56c85a0de339
Parents: 757c245
Author: Shalin Shekhar Mangar <shalin@apache.org>
Authored: Tue Aug 30 00:01:17 2016 +0530
Committer: Shalin Shekhar Mangar <shalin@apache.org>
Committed: Tue Aug 30 00:01:17 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                      |  2 ++
 .../java/org/apache/solr/cloud/DeleteShardCmd.java    | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2700b952/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 70c9f1e..5f8694f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -89,6 +89,8 @@ Bug Fixes
 
 * SOLR-9188: blockUnknown property makes inter-node communication impossible (noble)
 
+* SOLR-9455: Deleting a sub-shard in recovery state can mark parent shard as inactive. (shalin)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2700b952/solr/core/src/java/org/apache/solr/cloud/DeleteShardCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/DeleteShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/DeleteShardCmd.java
index f2ae5ca..a7f6d5b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/DeleteShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/DeleteShardCmd.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.solr.cloud.OverseerCollectionMessageHandler.Cmd;
+import org.apache.solr.cloud.overseer.OverseerAction;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
@@ -73,6 +74,19 @@ public class DeleteShardCmd implements Cmd {
       throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "The slice: " + slice.getName()
+ " is currently " + state
           + ". Only non-active (or custom-hashed) slices can be deleted.");
     }
+
+    if (state == Slice.State.RECOVERY)  {
+      // mark the slice as 'construction' and only then try to delete the cores
+      // see SOLR-9455
+      DistributedQueue inQueue = Overseer.getStateUpdateQueue(ocmh.zkStateReader.getZkClient());
+      Map<String, Object> propMap = new HashMap<>();
+      propMap.put(Overseer.QUEUE_OPERATION, OverseerAction.UPDATESHARDSTATE.toLower());
+      propMap.put(sliceId, Slice.State.CONSTRUCTION.toString());
+      propMap.put(ZkStateReader.COLLECTION_PROP, collectionName);
+      ZkNodeProps m = new ZkNodeProps(propMap);
+      inQueue.offer(Utils.toJSON(m));
+    }
+
     ShardHandler shardHandler = ocmh.shardHandlerFactory.getShardHandler();
 
     String asyncId = message.getStr(ASYNC);


Mime
View raw message