Skip to content

Commit

Permalink
Check shard availability before including in stats (#96015) (#96016)
Browse files Browse the repository at this point in the history
With this commit we check whether there is an available shard routing
before we test whether it has been started. This makes
`DataTiersUsageTransportAction` more resilient to potential temporary
inconsistencies between cluster state and node stats due to concurrent
shard movement.

Closes #87001
Closes #96000
  • Loading branch information
danielmitterdorfer authored May 11, 2023
1 parent a8a8c71 commit e7680af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/changelog/96015.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pr: 96015
summary: Check shard availability before including in stats
area: Distributed
type: bug
issues:
- 96000
- 87001
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ private static void aggregateDataTierShardStats(NodeStats nodeStats, Index index
accumulator.docCount += shardStat.getTotal().getDocs().getCount();

// Accumulate stats about started shards
if (node.getByShardId(shardStat.getShardId()).state() == ShardRoutingState.STARTED) {
ShardRouting shardRouting = node.getByShardId(shardStat.getShardId());
if (shardRouting != null && shardRouting.state() == ShardRoutingState.STARTED) {
accumulator.totalShardCount += 1;

// Accumulate stats about started primary shards
Expand Down

0 comments on commit e7680af

Please sign in to comment.