Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
removed prs check from coll creation cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
hiteshk25 committed Jun 25, 2022
1 parent 2baba0c commit 83d7372
Showing 1 changed file with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,7 @@ public void call(ClusterState clusterState, ZkNodeProps message, @SuppressWarnin
ZkStateReader.NODE_NAME_PROP, nodeName,
ZkStateReader.REPLICA_TYPE, replicaPosition.type.name(),
CommonAdminParams.WAIT_FOR_FINAL_STATE, Boolean.toString(waitForFinalState));
if (isPRS) {
// In case of a PRS collection, execute the ADDREPLICA directly instead of resubmitting
// to the overseer queue.
// TODO: Consider doing this for all collections, not just the PRS collections.
ZkWriteCommand command = new SliceMutator(ocmh.cloudManager).addReplica(clusterState, props);
clusterState = clusterState.copyWith(collectionName, command.collection);
newColl = command.collection;
} else {
ocmh.overseer.offerStateUpdate(Utils.toJSON(props));
}
ocmh.overseer.offerStateUpdate(Utils.toJSON(props));
}

// Need to create new params for each request
Expand Down Expand Up @@ -318,23 +309,11 @@ public void call(ClusterState clusterState, ZkNodeProps message, @SuppressWarnin
coresToCreate.put(coreName, sreq);
}
}
if(isPRS) {
byte[] data = Utils.toJSON(Collections.singletonMap(collectionName, clusterState.getCollection(collectionName)));
ocmh.zkStateReader.getZkClient().setData(collectionPath, data, true);
ocmh.overseer.submit(new RefreshCollectionMessage(collectionName));
}

if(!isLegacyCloud) {
// wait for all replica entries to be created
Map<String, Replica> replicas ;
if (isPRS) {
replicas = new ConcurrentHashMap<>();
newColl.getSlices().stream().flatMap(slice -> slice.getReplicas().stream())
.filter(r -> coresToCreate.containsKey(r.getCoreName())) // Only the elements that were asked for...
.forEach(r -> replicas.putIfAbsent(r.getCoreName(), r)); // ...get added to the map
} else {
replicas = ocmh.waitToSeeReplicasInState(collectionName, coresToCreate.keySet());
}
replicas = ocmh.waitToSeeReplicasInState(collectionName, coresToCreate.keySet());

for (Map.Entry<String, ShardRequest> e : coresToCreate.entrySet()) {
ShardRequest sreq = e.getValue();
Expand Down

0 comments on commit 83d7372

Please sign in to comment.