mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
now that the change to refresh can execute on not yet active shards, we need to ignore illegal shard state failures (expected...)
This commit is contained in:
parent
d69baa3e04
commit
9c6dfc1508
@ -20,6 +20,7 @@
|
|||||||
package org.elasticsearch.action.admin.indices.refresh;
|
package org.elasticsearch.action.admin.indices.refresh;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticSearchException;
|
import org.elasticsearch.ElasticSearchException;
|
||||||
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.action.ShardOperationFailedException;
|
import org.elasticsearch.action.ShardOperationFailedException;
|
||||||
import org.elasticsearch.action.TransportActions;
|
import org.elasticsearch.action.TransportActions;
|
||||||
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
|
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
|
||||||
@ -32,6 +33,7 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.engine.Engine;
|
import org.elasticsearch.index.engine.Engine;
|
||||||
|
import org.elasticsearch.index.shard.IllegalIndexShardStateException;
|
||||||
import org.elasticsearch.index.shard.service.IndexShard;
|
import org.elasticsearch.index.shard.service.IndexShard;
|
||||||
import org.elasticsearch.indices.IndicesService;
|
import org.elasticsearch.indices.IndicesService;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
@ -77,6 +79,14 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override protected boolean ignoreException(Throwable t) {
|
||||||
|
Throwable actual = ExceptionsHelper.unwrapCause(t);
|
||||||
|
if (actual instanceof IllegalIndexShardStateException) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override protected RefreshResponse newResponse(RefreshRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {
|
@Override protected RefreshResponse newResponse(RefreshRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {
|
||||||
int successfulShards = 0;
|
int successfulShards = 0;
|
||||||
int failedShards = 0;
|
int failedShards = 0;
|
||||||
|
@ -99,6 +99,10 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean ignoreException(Throwable t) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean ignoreNonActiveExceptions() {
|
protected boolean ignoreNonActiveExceptions() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -267,13 +271,15 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||||||
@SuppressWarnings({"unchecked"}) void onOperation(@Nullable ShardRouting shard, final ShardIterator shardIt, Throwable t) {
|
@SuppressWarnings({"unchecked"}) void onOperation(@Nullable ShardRouting shard, final ShardIterator shardIt, Throwable t) {
|
||||||
ShardRouting nextShard = shardIt.nextOrNull();
|
ShardRouting nextShard = shardIt.nextOrNull();
|
||||||
if (nextShard != null) {
|
if (nextShard != null) {
|
||||||
// trace log this exception
|
if (t != null) {
|
||||||
if (logger.isTraceEnabled()) {
|
// trace log this exception
|
||||||
if (t != null) {
|
if (logger.isTraceEnabled()) {
|
||||||
if (shard != null) {
|
if (!ignoreException(t)) {
|
||||||
logger.trace(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
if (shard != null) {
|
||||||
} else {
|
logger.trace(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
||||||
logger.trace(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
} else {
|
||||||
|
logger.trace(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,10 +292,12 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||||||
// e is null when there is no next active....
|
// e is null when there is no next active....
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
if (shard != null) {
|
if (!ignoreException(t)) {
|
||||||
logger.debug(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
if (shard != null) {
|
||||||
} else {
|
logger.debug(shard.shortSummary() + ": Failed to execute [" + request + "]", t);
|
||||||
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
} else {
|
||||||
|
logger.debug(shardIt.shardId() + ": Failed to execute [" + request + "]", t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,8 +308,14 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
|
|||||||
if (!ignoreNonActiveExceptions()) {
|
if (!ignoreNonActiveExceptions()) {
|
||||||
t = new BroadcastShardOperationFailedException(shardIt.shardId(), "No active shard(s)");
|
t = new BroadcastShardOperationFailedException(shardIt.shardId(), "No active shard(s)");
|
||||||
}
|
}
|
||||||
} else if (!(t instanceof BroadcastShardOperationFailedException)) {
|
} else {
|
||||||
t = new BroadcastShardOperationFailedException(shardIt.shardId(), t);
|
if (ignoreException(t)) {
|
||||||
|
t = null;
|
||||||
|
} else {
|
||||||
|
if (!(t instanceof BroadcastShardOperationFailedException)) {
|
||||||
|
t = new BroadcastShardOperationFailedException(shardIt.shardId(), t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shardsResponses.set(index, t);
|
shardsResponses.set(index, t);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user