Skip to content

Commit

Permalink
Fix Segment Replication stats throwing NPE (#14580)
Browse files Browse the repository at this point in the history
Signed-off-by: Rampreeth Ethiraj <[email protected]>
  • Loading branch information
rampreeth authored Feb 17, 2025
1 parent 56825f6 commit 91a93da
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,9 @@ public ReplicationCheckpoint getLatestReplicationCheckpoint() {

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

0 comments on commit 91a93da

Please sign in to comment.