Skip to content

Commit

Permalink
Avoid noisy exceptions on data nodes when aborting snapshots (#88476)
Browse files Browse the repository at this point in the history
Currently, an abort (especially when triggered an index delete) can
manifest as either an aborted snapshot exception, a missing index exception or
an NPE. The latter two show up as noise in logs.
This change catches effectively all of these cleanly as aborted snapshot
exceptions so they don't get logged as warnings and avoids the NPE if
a shard was removed from the index service concurrently by using the
API that throws on missing shards to look it up.
  • Loading branch information
original-brownbear authored Jul 12, 2022
1 parent 84af493 commit ba46bd4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,10 @@ private void snapshot(
ActionListener<ShardSnapshotResult> listener
) {
try {
final IndexShard indexShard = indicesService.indexServiceSafe(shardId.getIndex()).getShardOrNull(shardId.id());
if (snapshotStatus.isAborted()) {
throw new AbortedSnapshotException();
}
final IndexShard indexShard = indicesService.indexServiceSafe(shardId.getIndex()).getShard(shardId.id());
if (indexShard.routingEntry().primary() == false) {
throw new IndexShardSnapshotFailedException(shardId, "snapshot should be performed only on primary");
}
Expand Down

0 comments on commit ba46bd4

Please sign in to comment.