Skip to content

Commit 91a93da

Browse files
authored
Fix Segment Replication stats throwing NPE (opensearch-project#14580)
Signed-off-by: Rampreeth Ethiraj <ethirajrampreeth@gmail.com>
1 parent 56825f6 commit 91a93da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,9 @@ public ReplicationCheckpoint getLatestReplicationCheckpoint() {
12541254

12551255
// skip any shard that is a relocating primary or search only replica (not tracked by primary)
12561256
private boolean shouldSkipReplicationTimer(String allocationId) {
1257-
Optional<ShardRouting> shardRouting = routingTable.shards()
1257+
Optional<ShardRouting> shardRouting = routingTable.assignedShards()
12581258
.stream()
1259+
.filter(routing -> Objects.nonNull(routing.allocationId()))
12591260
.filter(routing -> routing.allocationId().getId().equals(allocationId))
12601261
.findAny();
12611262
return shardRouting.isPresent() && (shardRouting.get().primary() || shardRouting.get().isSearchOnly());

0 commit comments

Comments
 (0)