|
51 | 51 | import org.opensearch.env.ShardLockObtainFailedException;
|
52 | 52 | import org.opensearch.gateway.AsyncShardFetch.FetchResult;
|
53 | 53 | import org.opensearch.gateway.TransportNodesListGatewayStartedShards.NodeGatewayStartedShards;
|
54 |
| -import org.opensearch.indices.replication.checkpoint.ReplicationCheckpoint; |
55 | 54 |
|
56 | 55 | import java.util.ArrayList;
|
57 | 56 | import java.util.Collection;
|
@@ -137,13 +136,11 @@ public AllocateUnassignedDecision makeAllocationDecision(
|
137 | 136 | * @param shardsState {@link FetchResult<NodeGatewayStartedShards>}
|
138 | 137 | * */
|
139 | 138 | private static List<NodeGatewayStartedShards> adaptToNodeShardStates(FetchResult<NodeGatewayStartedShards> shardsState) {
|
140 |
| - if (!shardsState.hasData()){ |
| 139 | + if (!shardsState.hasData()) { |
141 | 140 | return null;
|
142 | 141 | }
|
143 | 142 | List<NodeGatewayStartedShards> nodeShardStates = new ArrayList<>();
|
144 |
| - shardsState.getData().forEach((node, nodeGatewayStartedShard) -> { |
145 |
| - nodeShardStates.add(nodeGatewayStartedShard); |
146 |
| - }); |
| 143 | + shardsState.getData().forEach((node, nodeGatewayStartedShard) -> { nodeShardStates.add(nodeGatewayStartedShard); }); |
147 | 144 | return nodeShardStates;
|
148 | 145 | }
|
149 | 146 |
|
@@ -349,13 +346,13 @@ private static ShardStoreInfo shardStoreInfo(NodeGatewayStartedShards nodeShardS
|
349 | 346 | (NodeGatewayStartedShards state) -> state.storeException() == null
|
350 | 347 | ).reversed();
|
351 | 348 | private static final Comparator<NodeGatewayStartedShards> PRIMARY_FIRST_COMPARATOR = Comparator.comparing(
|
352 |
| - NodeGatewayStartedShards::primary).reversed(); |
| 349 | + NodeGatewayStartedShards::primary |
| 350 | + ).reversed(); |
353 | 351 |
|
354 |
| - private static final Comparator<NodeGatewayStartedShards> HIGHEST_REPLICATION_CHECKPOINT_FIRST_COMPARATOR = |
355 |
| - Comparator.comparing( |
356 |
| - NodeGatewayStartedShards::replicationCheckpoint, |
357 |
| - Comparator.nullsLast(Comparator.naturalOrder()) |
358 |
| - ); |
| 352 | + private static final Comparator<NodeGatewayStartedShards> HIGHEST_REPLICATION_CHECKPOINT_FIRST_COMPARATOR = Comparator.comparing( |
| 353 | + NodeGatewayStartedShards::replicationCheckpoint, |
| 354 | + Comparator.nullsLast(Comparator.naturalOrder()) |
| 355 | + ); |
359 | 356 |
|
360 | 357 | /**
|
361 | 358 | * Builds a list of nodes. If matchAnyShard is set to false, only nodes that have an allocation id matching
|
@@ -437,7 +434,10 @@ protected static NodeShardsResult buildNodeShardsResult(
|
437 | 434 | return new NodeShardsResult(nodeShardStates, numberOfAllocationsFound);
|
438 | 435 | }
|
439 | 436 |
|
440 |
| - private static Comparator<NodeGatewayStartedShards> createActiveShardComparator(boolean matchAnyShard, Set<String> inSyncAllocationIds) { |
| 437 | + private static Comparator<NodeGatewayStartedShards> createActiveShardComparator( |
| 438 | + boolean matchAnyShard, |
| 439 | + Set<String> inSyncAllocationIds |
| 440 | + ) { |
441 | 441 | /**
|
442 | 442 | * Orders the active shards copies based on below comparators
|
443 | 443 | * 1. No store exception i.e. shard copy is readable
|
|
0 commit comments