mirror of https://github.com/apache/lucene.git
SOLR-12739: Release the policy session as soon as we're done with the computation.
This fixes the CollectionsAPIDistributedZkTest.testCoresAreDistributedAcrossNodes test failures. Due to the various tests for exceptional conditions, there were times where the session was not released causing stale data to remain in the policy session cache.
This commit is contained in:
parent
940a7303ee
commit
50d1c7b481
|
@ -141,10 +141,17 @@ public class AddReplicaCmd implements OverseerCollectionMessageHandler.Cmd {
|
|||
}
|
||||
|
||||
AtomicReference<PolicyHelper.SessionWrapper> sessionWrapper = new AtomicReference<>();
|
||||
List<CreateReplica> createReplicas = buildReplicaPositions(ocmh.cloudManager, clusterState, collectionName, message, replicaTypesVsCount, sessionWrapper)
|
||||
.stream()
|
||||
.map(replicaPosition -> assignReplicaDetails(ocmh.cloudManager, clusterState, message, replicaPosition))
|
||||
.collect(Collectors.toList());
|
||||
List<CreateReplica> createReplicas;
|
||||
try {
|
||||
createReplicas = buildReplicaPositions(ocmh.cloudManager, clusterState, collectionName, message, replicaTypesVsCount, sessionWrapper)
|
||||
.stream()
|
||||
.map(replicaPosition -> assignReplicaDetails(ocmh.cloudManager, clusterState, message, replicaPosition))
|
||||
.collect(Collectors.toList());
|
||||
} finally {
|
||||
if (sessionWrapper.get() != null) {
|
||||
sessionWrapper.get().release();
|
||||
}
|
||||
}
|
||||
|
||||
ShardHandler shardHandler = ocmh.shardHandlerFactory.getShardHandler();
|
||||
ZkStateReader zkStateReader = ocmh.zkStateReader;
|
||||
|
@ -162,10 +169,6 @@ public class AddReplicaCmd implements OverseerCollectionMessageHandler.Cmd {
|
|||
for (CreateReplica replica : createReplicas) {
|
||||
ocmh.waitForCoreNodeName(collectionName, replica.node, replica.coreName);
|
||||
}
|
||||
|
||||
if (sessionWrapper.get() != null) {
|
||||
sessionWrapper.get().release();
|
||||
}
|
||||
if (onComplete != null) onComplete.run();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue