Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/SOLR-18367-waitforfinalstate-removal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: The `waitForFinalState` parameter now defaults to `true` for CREATE, ADDREPLICA, CREATESHARD, MOVEREPLICA, SPLITSHARD, BALANCE_REPLICAS, MIGRATE_REPLICAS, and REPLACENODE Collections API commands, so these commands wait for all affected replicas to become active before returning. Removed the now-unnecessary `CollectionAdminRequest.AsyncCollectionAdminRequest.setWaitForFinalState` SolrJ method, deprecated in 9.10 (SOLR-17712).
type: changed
authors:
- name: Serhiy Bzhezytskyy
links:
- name: SOLR-18367
url: https://issues.apache.org/jira/browse/SOLR-18367
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ List<ZkNodeProps> addReplica(
"Collection: " + collectionName + " shard: " + shard + " does not exist");
}

boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, true);
boolean skipCreateReplicaInClusterState =
message.getBool(SKIP_CREATE_REPLICA_IN_CLUSTER_STATE, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
"'nodes' was not passed as a correct type (Set/List/String): "
+ nodesRaw.getClass().getName());
}
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, true);
int timeout = message.getInt("timeout", 10 * 60); // 10 minutes
boolean parallel = message.getBool("parallel", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
ClusterState clusterState = adminCmdContext.getClusterState();
final Aliases aliases = ccc.getZkStateReader().getAliases();
final String collectionName = message.getStr(NAME);
final boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, false);
final boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, true);
final String alias = message.getStr(ALIAS, collectionName);
log.info("Create collection {}", collectionName);
boolean prsDefault = EnvUtils.getPropertyAsBool(PRS_DEFAULT_PROP, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
throws Exception {
String extCollectionName = message.getStr(COLLECTION_PROP);
String sliceName = message.getStr(SHARD_ID_PROP);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, true);

log.info("Create shard invoked: {}", message);
if (extCollectionName == null || sliceName == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
ZkStateReader zkStateReader = ccc.getZkStateReader();
Set<String> sourceNodes = getNodesFromParam(message, CollectionParams.SOURCE_NODES);
Set<String> targetNodes = getNodesFromParam(message, CollectionParams.TARGET_NODES);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, true);
if (sourceNodes.isEmpty()) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST, "sourceNodes is a required param");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void moveReplica(
CollectionHandlingUtils.checkRequired(message, COLLECTION_PROP, CollectionParams.TARGET_NODE);
String extCollection = message.getStr(COLLECTION_PROP);
String targetNode = message.getStr(CollectionParams.TARGET_NODE);
boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(WAIT_FOR_FINAL_STATE, true);
boolean inPlaceMove = message.getBool(IN_PLACE_MOVE, true);
int timeout = message.getInt(TIMEOUT, 10 * 60); // 10 minutes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
ZkStateReader zkStateReader = ccc.getZkStateReader();
String source = message.getStr(CollectionParams.SOURCE_NODE);
String target = message.getStr(CollectionParams.TARGET_NODE);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, true);
if (source == null) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST, "sourceNode is a required param");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
public boolean split(
AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList<Object> results)
throws Exception {
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, false);
boolean waitForFinalState = message.getBool(CommonAdminParams.WAIT_FOR_FINAL_STATE, true);
String methodStr =
message.getStr(
CommonAdminParams.SPLIT_METHOD, SolrIndexSplitter.SplitMethod.REWRITE.toLower());
Expand Down
3 changes: 0 additions & 3 deletions solr/core/src/test/org/apache/solr/cloud/AddReplicaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ public void test() throws Exception {
replicas2.removeAll(replicas);
assertEquals(1, replicas2.size());

// use waitForFinalState
addReplica.setWaitForFinalState(true);
addReplica.processAsync("001", cloudClient);
requestStatus = CollectionAdminRequest.requestStatus("001");
rsp = requestStatus.process(cloudClient);
Expand Down Expand Up @@ -205,7 +203,6 @@ public void testAddReplicaWithUserDefinedProperties() throws Exception {
CollectionAdminRequest.addReplicaToShard(collectionName, "shard1");
addReplica.withProperty("customProp2", "val2.1");
addReplica.withProperty("customProp3", "val3");
addReplica.setWaitForFinalState(true);
addReplica.process(cloudClient);

// Verify that the new core was created with user-defined properties coming from the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public void testCreateAndDeleteCollection() throws Exception {
String collectionName = getSaferTestName();
CollectionAdminRequest.Create createREq =
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2);
createREq.setWaitForFinalState(false);
CollectionAdminResponse response = createREq.process(cluster.getSolrClient());

assertEquals(0, response.getStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public void test() throws Exception {
// let's do it back - this time wait for recoveries
CollectionAdminRequest.AsyncCollectionAdminRequest replaceNodeRequest =
createReplaceNodeRequest(emptyNode, nodeToBeDecommissioned, Boolean.TRUE);
replaceNodeRequest.setWaitForFinalState(true);
replaceNodeRequest.processAndWait("001", cloudClient, 10);

try (SolrClient coreClient =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public void testWithChildDocuments() throws Exception {
CollectionAdminRequest.splitShard(COLLECTION_NAME)
.setNumSubShards(2)
.setShardName("shard1");
splitShard.setWaitForFinalState(true);
splitShard.process(solrClient);
waitForState(
"Waiting for 2 active shards after split", COLLECTION_NAME, activeClusterShape(2, 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ public void testTwoCollectionsWithDifferentProps() throws Exception {

private static void processAndAssertSuccess(final CollectionAdminRequest.Create op)
throws Exception {
op.setWaitForFinalState(true);
assertTrue(op.process(cluster.getSolrClient()).isSuccess());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public abstract static class AsyncCollectionAdminRequest
extends CollectionAdminRequest<CollectionAdminResponse> {

protected String asyncId = null;
protected boolean waitForFinalState = false;
protected boolean waitForFinalState = true;

public AsyncCollectionAdminRequest(CollectionAction action) {
super(action);
Expand All @@ -165,11 +165,6 @@ public String getAsyncId() {
return asyncId;
}

@Deprecated(since = "9.10")
public void setWaitForFinalState(boolean waitForFinalState) {
this.waitForFinalState = waitForFinalState;
}

public void setAsyncId(String asyncId) {
this.asyncId = asyncId;
}
Expand Down
Loading