Skip to content

Commit

Permalink
fixed replica code
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
shiv0408 committed Jul 28, 2023
1 parent 20037de commit 3a96a8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ public void afterPrimariesBeforeReplicas(RoutingAllocation allocation) {
List<Set<ShardRouting>> storedShardBatches = batchIdToStoreShardBatch.values().stream()
.map(ShardsBatch::getBatchedShardRoutings)
.collect(Collectors.toList());
replicaBatchShardAllocator.processExistingRecoveries(allocation, storedShardBatches);
if (allocation.routingNodes().hasInactiveShards()) {
// cancel existing recoveries if we have a better match
replicaBatchShardAllocator.processExistingRecoveries(allocation, storedShardBatches);
}
} else {
assert replicaShardAllocator != null;
if (allocation.routingNodes().hasInactiveShards()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,11 @@ public HashMap<ShardRouting, AllocateUnassignedDecision> makeAllocationDecision(
AllocateUnassignedDecision.no(UnassignedInfo.AllocationStatus.fromDecision(allocationDecision.type()),
result.v2() != null ? new ArrayList<>(result.v2().values()) : null));
continue;
} else if (allocationDecision.type() != Decision.Type.YES) {
// storing the nodeDecisions in nodeAllocationDecisions if the decision is not YES
// so that we don't have to compute the decisions again
// ToDo: Check if we need to store or computing again will be cheaper/better
nodeAllocationDecisions.put(shard, result);
}
// storing the nodeDecisions in nodeAllocationDecisions if the decision is not YES
// so that we don't have to compute the decisions again
// ToDo: Check if we need to store or computing again will be cheaper/better
nodeAllocationDecisions.put(shard, result);

shardsEligibleForFetch.add(shard);
}
Expand Down

0 comments on commit 3a96a8c

Please sign in to comment.