Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ public void sendShardRequest(
if (asyncId != null) {
String coreAdminAsyncId = asyncId + Math.abs(System.nanoTime());
params.set(ASYNC, coreAdminAsyncId);
track(nodeName, coreAdminAsyncId);
// Track async requests
shardAsyncIdByNode.add(nodeName, coreAdminAsyncId);
}

ShardRequest sreq = new ShardRequest();
Expand Down Expand Up @@ -720,13 +721,5 @@ private void waitForAsyncCallsToComplete(NamedList<Object> results) {
}
}
}

/**
* @deprecated consider to make it private after {@link CreateCollectionCmd} refactoring
*/
@Deprecated
void track(String nodeName, String coreAdminAsyncId) {
shardAsyncIdByNode.add(nodeName, coreAdminAsyncId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
import org.apache.solr.core.CoreContainer;
import org.apache.solr.handler.admin.ConfigSetsHandler;
import org.apache.solr.handler.component.ShardHandler;
import org.apache.solr.handler.component.ShardRequest;
import org.apache.solr.util.TimeOut;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
Expand Down Expand Up @@ -266,7 +265,9 @@ public void call(ClusterState clusterState, ZkNodeProps message, NamedList<Objec
"Creating SolrCores for new collection {0}, shardNames {1} , message : {2}",
collectionName, shardNames, message));
}
Map<String, ShardRequest> coresToCreate = new LinkedHashMap<>();

Map<String, ModifiableSolrParams> coresToCreate = new LinkedHashMap<>();
Map<String, String> nodeNames = new HashMap<>();
ShardHandler shardHandler = ccc.newShardHandler();
final DistributedClusterStateUpdater.StateChangeRecorder scr;

Expand Down Expand Up @@ -359,19 +360,11 @@ public void call(ClusterState clusterState, ZkNodeProps message, NamedList<Objec
if (async != null) {
String coreAdminAsyncId = async + Math.abs(System.nanoTime());
params.add(ASYNC, coreAdminAsyncId);
shardRequestTracker.track(nodeName, coreAdminAsyncId);
}
CollectionHandlingUtils.addPropertyParams(message, params);

ShardRequest sreq = new ShardRequest();
sreq.nodeName = nodeName;
params.set("qt", ccc.getAdminPath());
sreq.purpose = ShardRequest.PURPOSE_PRIVATE;
sreq.shards = new String[] {baseUrl};
sreq.actualShards = sreq.shards;
sreq.params = params;
Comment on lines -366 to -372
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what became of this?

Copy link
Contributor Author

@psalagnac psalagnac Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have commented in the PR. This is all done by calling shardRequestTracker.sendShardRequest() that then calls ShardHandler. To me, this is all internal to shard handler, there was no good reasons to duplicate this in the command.


coresToCreate.put(coreName, sreq);
coresToCreate.put(coreName, params);
nodeNames.put(coreName, nodeName);
}

// Update the state.json for PRS collection in a single operation
Expand Down Expand Up @@ -411,10 +404,11 @@ public void call(ClusterState clusterState, ZkNodeProps message, NamedList<Objec
coresToCreate.keySet());
}

for (Map.Entry<String, ShardRequest> e : coresToCreate.entrySet()) {
ShardRequest sreq = e.getValue();
sreq.params.set(CoreAdminParams.CORE_NODE_NAME, replicas.get(e.getKey()).getName());
shardHandler.submit(sreq, sreq.shards[0], sreq.params);
for (Map.Entry<String, ModifiableSolrParams> e : coresToCreate.entrySet()) {
ModifiableSolrParams params = e.getValue();
String nodeName = nodeNames.get(e.getKey());
params.set(CoreAdminParams.CORE_NODE_NAME, replicas.get(e.getKey()).getName());
shardRequestTracker.sendShardRequest(nodeName, params, shardHandler);
}

shardRequestTracker.processResponses(
Expand Down