Skip to content

Commit

Permalink
log improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
DiannaHohensee committed Nov 14, 2024
1 parent 1a71abb commit d430547
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -3480,26 +3481,28 @@ private static void ensureNotAborted(ShardId shardId, SnapshotId snapshotId, Ind
// A normally running shard snapshot should be in stage INIT or STARTED. And we know it's not in PAUSING or ABORTED because
// the ensureNotAborted() call above did not throw. The remaining options don't make sense, if they ever happen.
logger.error(
"Shard snapshot found no interrupt signal, but is in an unexpected state. ShardId [{}], SnapshotID [{}], Stage [{}]",
shardId,
snapshotId,
shardSnapshotStage
() -> Strings.format(
"Shard snapshot found an unexpected state. ShardId [{}], SnapshotID [{}], Stage [{}]",
shardId,
snapshotId,
shardSnapshotStage
)
);
assert false;
}
} catch (Exception e) {
// We want to see when a shard snapshot operation checks for and finds an interrupt signal during shutdown. A
// PausedSnapshotException indicates we're in shutdown because that's the only case when shard snapshots are signaled to pause.
// An AbortedSnapshotException may also occur during shutdown if an uncommon error occurs.
ShutdownLogger.shutdownLogger.debug(
"Shard snapshot operation is aborting. ShardId [{}], SnapshotID [{}], File [{}], Stage [{}], Message [{}], Stacktrace: {}",
Supplier<?> messageSupplier = () -> String.format(
Locale.ROOT,
"Shard snapshot operation is aborting. ShardId [%s], SnapshotID [%s], File [%s], Stage [%s]",
shardId,
snapshotId,
fileName,
shardSnapshotStage,
e.getMessage(),
e.getStackTrace()
shardSnapshotStage
);
ShutdownLogger.shutdownLogger.debug(messageSupplier, e);
assert e instanceof AbortedSnapshotException || e instanceof PausedSnapshotException : e;
throw e;
}
Expand Down

0 comments on commit d430547

Please sign in to comment.