Skip to content

Commit 608bb33

Browse files
committed
Do not log warn shard not-available exception in replication (#30205)
Since #28049, only fully initialized shards are received write requests. This enhancement allows us to handle all exceptions. In #28571, we started strictly handling shard-not-available exceptions and tried to keep the way we report replication errors to users by only reporting if the error is not shard-not-available exceptions. However, since then we unintentionally always log warn for all exception. This change restores to the previous behavior which logs warn only if an exception is not a shard-not-available exception. Relates #28049 Relates #28571
1 parent 7d90c32 commit 608bb33

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/action/support/replication/TransportWriteAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ class WriteActionReplicasProxy extends ReplicasProxy {
384384
@Override
385385
public void failShardIfNeeded(ShardRouting replica, String message, Exception exception,
386386
Runnable onSuccess, Consumer<Exception> onPrimaryDemoted, Consumer<Exception> onIgnoredFailure) {
387-
logger.warn(new ParameterizedMessage("[{}] {}", replica.shardId(), message), exception);
387+
if (TransportActions.isShardNotAvailableException(exception) == false) {
388+
logger.warn(new ParameterizedMessage("[{}] {}", replica.shardId(), message), exception);
389+
}
388390
shardStateAction.remoteShardFailed(replica.shardId(), replica.allocationId().getId(), primaryTerm, true, message, exception,
389391
createShardActionListener(onSuccess, onPrimaryDemoted, onIgnoredFailure));
390392
}

0 commit comments

Comments
 (0)