Skip to content

Commit

Permalink
Fix NPE bug
Browse files Browse the repository at this point in the history
Signed-off-by: Rishab Nahata <[email protected]>
  • Loading branch information
imRishN committed Jul 22, 2024
1 parent 1c5c211 commit 3d8b9e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.opensearch.cluster.routing.allocation.decider.Decision;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.BatchRunnableExecutor;
import org.opensearch.gateway.GatewayAllocator;
import org.opensearch.gateway.PriorityComparator;
import org.opensearch.gateway.ShardsBatchGatewayAllocator;
Expand Down Expand Up @@ -624,10 +625,16 @@ private void allocateExistingUnassignedShards(RoutingAllocation allocation) {

private void allocateAllUnassignedShards(RoutingAllocation allocation) {
ExistingShardsAllocator allocator = existingShardsAllocators.get(ShardsBatchGatewayAllocator.ALLOCATOR_NAME);
allocator.allocateAllUnassignedShards(allocation, true).run();
BatchRunnableExecutor primaryShardsBatchExecutor = allocator.allocateAllUnassignedShards(allocation, true);
if (primaryShardsBatchExecutor != null) {
primaryShardsBatchExecutor.run();
}
allocator.afterPrimariesBeforeReplicas(allocation);
// Replicas Assignment
allocator.allocateAllUnassignedShards(allocation, false).run();
BatchRunnableExecutor replicaShardsBatchExecutor = allocator.allocateAllUnassignedShards(allocation, false);
if (replicaShardsBatchExecutor != null) {
replicaShardsBatchExecutor.run();
}
}

private void disassociateDeadNodes(RoutingAllocation allocation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.opensearch.common.util;public class BatchRunnableExecutorTest {
}

0 comments on commit 3d8b9e4

Please sign in to comment.