You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2019/12/13 22:56:11 UTC
[lucene-solr] branch branch_8x updated: SOLR-14079: fix SPLITSHARD
splitByPrefix in async mode
This is an automated email from the ASF dual-hosted git repository.
yonik pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 1be8170 SOLR-14079: fix SPLITSHARD splitByPrefix in async mode
1be8170 is described below
commit 1be81700becc96eb0322e4d704d5aaddba365e23
Author: yonik <yo...@apache.org>
AuthorDate: Fri Dec 13 17:55:05 2019 -0500
SOLR-14079: fix SPLITSHARD splitByPrefix in async mode
---
solr/CHANGES.txt | 4 ++++
.../solr/cloud/api/collections/SplitShardCmd.java | 3 +--
.../solr/cloud/api/collections/SplitByPrefixTest.java | 19 +++++++++++++++++++
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5a63439..0b1c338 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -241,6 +241,10 @@ Bug Fixes
* SOLR-14013: FIX: javabin performance regressions (noble, yonik, Houston Putman)
+* SOLR-14079: SPLITSHARD splitByPrefix doesn't work in async mode. This also
+ affects splits triggered by the autoscale framework, which use async mode.
+ (Megan Carey, Andy Vuong, Bilal Waheed, Ilan Ginzburg, yonik)
+
Other Changes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
index 333051a..26b1f0d 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
@@ -223,12 +223,11 @@ public class SplitShardCmd implements OverseerCollectionMessageHandler.Cmd {
// params.set(NUM_SUB_SHARDS, Integer.toString(numSubShards));
{
- final ShardRequestTracker shardRequestTracker = ocmh.asyncRequestTracker(asyncId);
+ final ShardRequestTracker shardRequestTracker = ocmh.syncRequestTracker();
shardRequestTracker.sendShardRequest(parentShardLeader.getNodeName(), params, shardHandler);
SimpleOrderedMap<Object> getRangesResults = new SimpleOrderedMap<>();
String msgOnError = "SPLITSHARD failed to invoke SPLIT.getRanges core admin command";
shardRequestTracker.processResponses(getRangesResults, shardHandler, true, msgOnError);
- handleFailureOnAsyncRequest(results, msgOnError);
// Extract the recommended splits from the shard response (if it exists)
// example response: getRangesResults={success={127.0.0.1:62086_solr={responseHeader={status=0,QTime=1},ranges=10-20,3a-3f}}}
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/SplitByPrefixTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/SplitByPrefixTest.java
index 5ec53e5..cca4fe4 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/SplitByPrefixTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/SplitByPrefixTest.java
@@ -148,6 +148,10 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
@Test
public void doTest() throws IOException, SolrServerException {
+ // SPLITSHARD is recommended to be run in async mode, so we default to that.
+ // Also, autoscale triggers use async with splits as well.
+ boolean doAsync = true;
+
CollectionAdminRequest
.createCollection(COLLECTION_NAME, "conf", 1, 1)
.setMaxShardsPerNode(100)
@@ -165,6 +169,9 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
.setNumSubShards(2)
.setSplitByPrefix(true)
.setShardName("shard1");
+ if (doAsync) {
+ splitShard.setAsyncId("SPLIT1");
+ }
splitShard.process(client);
waitForState("Timed out waiting for sub shards to be active.",
COLLECTION_NAME, activeClusterShape(2, 3)); // expectedReplicas==3 because original replica still exists (just inactive)
@@ -187,6 +194,9 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
splitShard = CollectionAdminRequest.splitShard(COLLECTION_NAME)
.setSplitByPrefix(true)
.setShardName("shard1_1"); // should start out with the range of 0-7fffffff
+ if (doAsync) {
+ splitShard.setAsyncId("SPLIT2");
+ }
splitShard.process(client);
waitForState("Timed out waiting for sub shards to be active.",
COLLECTION_NAME, activeClusterShape(3, 5));
@@ -216,6 +226,9 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
splitShard = CollectionAdminRequest.splitShard(COLLECTION_NAME)
.setSplitByPrefix(true)
.setShardName(slice1.getName());
+ if (doAsync) {
+ splitShard.setAsyncId("SPLIT3");
+ }
splitShard.process(client);
waitForState("Timed out waiting for sub shards to be active.",
COLLECTION_NAME, activeClusterShape(4, 7));
@@ -236,6 +249,9 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
splitShard = CollectionAdminRequest.splitShard(COLLECTION_NAME)
.setSplitByPrefix(true)
.setShardName(slice1.getName());
+ if (doAsync) {
+ splitShard.setAsyncId("SPLIT4");
+ }
splitShard.process(client);
waitForState("Timed out waiting for sub shards to be active.",
COLLECTION_NAME, activeClusterShape(5, 9));
@@ -252,6 +268,9 @@ public class SplitByPrefixTest extends SolrCloudTestCase {
splitShard = CollectionAdminRequest.splitShard(COLLECTION_NAME)
.setSplitByPrefix(true)
.setShardName(slice1.getName());
+ if (doAsync) {
+ splitShard.setAsyncId("SPLIT5");
+ }
splitShard.process(client);
waitForState("Timed out waiting for sub shards to be active.",
COLLECTION_NAME, activeClusterShape(6, 11));