Don't output null source node in RecoveryFailedException (#21963)

The RecoveryFailedException's output prints the source and
target nodes for the recovery.  However, sometimes there is
no source node for the recovery, only a target node (such as
when recovering a primary shard from disk).  In this case,
we don't want to display the source node.  This commit fixes
this by displaying "Recovery failed on target node.." instead
of "Recovery failed from null to target node" which is what the
output currently displays.
This commit is contained in:
Ali Beyad 2016-12-04 15:23:35 -05:00 committed by GitHub
parent 60aa14f48e
commit ff9959c865
1 changed files with 2 additions and 1 deletions

View File

@ -46,7 +46,8 @@ public class RecoveryFailedException extends ElasticsearchException {
}
public RecoveryFailedException(ShardId shardId, DiscoveryNode sourceNode, DiscoveryNode targetNode, @Nullable String extraInfo, Throwable cause) {
super(shardId + ": Recovery failed from " + sourceNode + " into " + targetNode + (extraInfo == null ? "" : " (" + extraInfo + ")"), cause);
super(shardId + ": Recovery failed " + (sourceNode != null ? "from " + sourceNode + " into " : "on ") +
targetNode + (extraInfo == null ? "" : " (" + extraInfo + ")"), cause);
}
public RecoveryFailedException(StreamInput in) throws IOException {