mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Trace log all shard failures if an exception is attached.
This commit is contained in:
parent
44382ae629
commit
7cd189b3d3
@ -279,33 +279,32 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
|
||||
}
|
||||
} else {
|
||||
ShardRouting nextShard = shardIt.nextOrNull();
|
||||
if (nextShard != null) {
|
||||
// trace log this exception
|
||||
if (logger.isTraceEnabled()) {
|
||||
if (t != null) {
|
||||
if (shard != null) {
|
||||
logger.trace(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
||||
} else {
|
||||
logger.trace(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean lastShard = nextShard == null;
|
||||
// trace log this exception
|
||||
if (logger.isTraceEnabled() && t != null) {
|
||||
logger.trace(executionFailureMsg(shard, shardIt, request, lastShard), t);
|
||||
}
|
||||
if (!lastShard) {
|
||||
performFirstPhase(shardIndex, shardIt, nextShard);
|
||||
} else {
|
||||
// no more shards active, add a failure
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (logger.isDebugEnabled() && !logger.isTraceEnabled()) { // do not double log this exception
|
||||
if (t != null && !TransportActions.isShardNotAvailableException(t)) {
|
||||
if (shard != null) {
|
||||
logger.debug(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
||||
} else {
|
||||
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
||||
}
|
||||
logger.debug(executionFailureMsg(shard, shardIt, request, lastShard), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String executionFailureMsg(@Nullable ShardRouting shard, final ShardIterator shardIt, SearchRequest request, boolean lastShard) {
|
||||
if (shard != null) {
|
||||
return shard.shortSummary() + ": Failed to execute [" + request + "] lastShard [" + lastShard + "]";
|
||||
} else {
|
||||
return shardIt.shardId() + ": Failed to execute [" + request + "] lastShard [" + lastShard + "]";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds how long it took to execute the search.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user