Skip to content

Commit

Permalink
Changing search shard failure logging to trace from debug (opensearch…
Browse files Browse the repository at this point in the history
…-project#8470)

* Changing shard failure logging to trace from debug
* Moving the exception to trace logs

Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com

---------

Signed-off-by: Sagar Upadhyaya <sagar.upadhyaya.121@gmail.com>
  • Loading branch information
sgup432 committed Jul 14, 2023
1 parent 6a19660 commit e8f1c30
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,27 @@ private void onShardFailure(final int shardIndex, @Nullable SearchShardTarget sh
.findNext(shardIt, clusterState, e, () -> totalOps.incrementAndGet());

final boolean lastShard = nextShard == null;
logger.debug(
() -> new ParameterizedMessage(
"{}: Failed to execute [{}] lastShard [{}]",
shard != null ? shard : shardIt.shardId(),
request,
lastShard
),
e
);
if (logger.isTraceEnabled()) {
logger.trace(
() -> new ParameterizedMessage(
"{}: Failed to execute [{}] lastShard [{}]",
shard != null ? shard : shardIt.shardId(),
request,
lastShard
),
e
);
} else {
// Log the message without an exception.
logger.debug(
new ParameterizedMessage(
"{}: Failed to execute [{}] lastShard [{}]",
shard != null ? shard : shardIt.shardId(),
request,
lastShard
)
);
}
if (lastShard) {
onShardGroupFailure(shardIndex, shard, e);
}
Expand Down

0 comments on commit e8f1c30

Please sign in to comment.