better exception message with primary not started exception on index/delete/delete_by_query apis
This commit is contained in:
parent
07285d81d1
commit
8c25be6dee
|
@ -35,6 +35,6 @@ public class PrimaryNotStartedActionException extends ElasticSearchException {
|
||||||
if (shardId == null) {
|
if (shardId == null) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
return "[" + shardId.index() + "][" + shardId.id() + "]" + message;
|
return "[" + shardId.index().name() + "][" + shardId.id() + "] " + message;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -77,6 +77,6 @@ public class ShardReplicationPingRequest extends ShardReplicationOperationReques
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "[" + index + "][" + shardId + "]";
|
return "replication_ping {[" + index + "][" + shardId + "]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,6 +60,6 @@ class ShardGatewaySnapshotRequest extends ShardReplicationOperationRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "[" + index + "][" + shardId + "]";
|
return "gateway_snapshot {[" + index + "][" + shardId + "]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -167,6 +167,6 @@ public class DeleteRequest extends ShardReplicationOperationRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "[" + index + "][" + type + "][" + id + "]";
|
return "delete {[" + index + "][" + type + "][" + id + "]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -120,6 +120,12 @@ public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "[" + index + "]" + Arrays.toString(types) + ", query [" + Unicode.fromBytes(querySource) + "]";
|
String sSource = "_na_";
|
||||||
|
try {
|
||||||
|
sSource = Unicode.fromBytes(querySource);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return "delete_by_query {[" + index + "]" + Arrays.toString(types) + ", query [" + sSource + "]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -413,6 +413,12 @@ public class IndexRequest extends ShardReplicationOperationRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "[" + index + "][" + type + "][" + id + "], source[" + Unicode.fromBytes(source, sourceOffset, sourceLength) + "]";
|
String sSource = "_na_";
|
||||||
|
try {
|
||||||
|
sSource = Unicode.fromBytes(source, sourceOffset, sourceLength);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
return "index {[" + index + "][" + type + "][" + id + "], source[" + sSource + "]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -316,7 +316,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
||||||
}
|
}
|
||||||
// we should never get here, but here we go
|
// we should never get here, but here we go
|
||||||
if (!foundPrimary) {
|
if (!foundPrimary) {
|
||||||
final PrimaryNotStartedActionException failure = new PrimaryNotStartedActionException(shards.shardId(), "Primary not found");
|
final PrimaryNotStartedActionException failure = new PrimaryNotStartedActionException(shards.shardId(), request.toString());
|
||||||
if (request.listenerThreaded()) {
|
if (request.listenerThreaded()) {
|
||||||
threadPool.execute(new Runnable() {
|
threadPool.execute(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
@ -361,7 +361,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clusterService.remove(this);
|
clusterService.remove(this);
|
||||||
final PrimaryNotStartedActionException failure = new PrimaryNotStartedActionException(shardId, "Timeout waiting for [" + timeValue + "]");
|
final PrimaryNotStartedActionException failure = new PrimaryNotStartedActionException(shardId, "Timeout waiting for [" + timeValue + "], request: " + request.toString());
|
||||||
if (request.listenerThreaded()) {
|
if (request.listenerThreaded()) {
|
||||||
threadPool.execute(new Runnable() {
|
threadPool.execute(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
|
Loading…
Reference in New Issue