public final void onShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Exception e) { if (TransportActions.isShardNotAvailableException(e) == false) { AtomicArray<ShardSearchFailure> shardFailures = this.shardFailures.get(); if (TransportActions.isReadOverrideException(e)) { shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
/** * If a failure is already present, should this failure override it or not for read operations. */ public static boolean isReadOverrideException(Exception e) { return !isShardNotAvailableException(e); }
@Override protected boolean retryOnFailure(Exception e) { return TransportActions.isShardNotAvailableException(e); }
protected boolean retryPrimaryException(final Throwable e) { return e.getClass() == ReplicationOperation.RetryOnPrimaryException.class || TransportActions.isShardNotAvailableException(e) || isRetryableClusterBlockException(e); }
protected final void addShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Throwable t) { // we don't aggregate shard failures on non active shards (but do keep the header counts right) if (TransportActions.isShardNotAvailableException(t)) { return; } // lazily create shard failures, so we can early build the empty shard failure list in most cases (no failures) if (shardFailures == null) { synchronized (shardFailuresMutex) { if (shardFailures == null) { shardFailures = new AtomicArray<>(shardsIts.size()); } } } ShardSearchFailure failure = shardFailures.get(shardIndex); if (failure == null) { shardFailures.set(shardIndex, new ShardSearchFailure(t, shardTarget)); } else { // the failure is already present, try and not override it with an exception that is less meaningless // for example, getting illegal shard state if (TransportActions.isReadOverrideException(t)) { shardFailures.set(shardIndex, new ShardSearchFailure(t, shardTarget)); } } }
@Override public void onFailure(Exception replicaException) { logger.trace(() -> new ParameterizedMessage( "[{}] failure while performing [{}] on replica {}, request [{}]", shard.shardId(), opType, shard, replicaRequest), replicaException); // Only report "critical" exceptions - TODO: Reach out to the master node to get the latest shard state then report. if (TransportActions.isShardNotAvailableException(replicaException) == false) { RestStatus restStatus = ExceptionsHelper.status(replicaException); shardReplicaFailures.add(new ReplicationResponse.ShardInfo.Failure( shard.shardId(), shard.currentNodeId(), replicaException, restStatus, false)); } String message = String.format(Locale.ROOT, "failed to perform %s on replica %s", opType, shard); replicasProxy.failShardIfNeeded(shard, message, replicaException, ReplicationOperation.this::decPendingAndFinishIfNeeded, ReplicationOperation.this::onPrimaryDemoted, throwable -> decPendingAndFinishIfNeeded()); } });
public final void onShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Exception e) { if (TransportActions.isShardNotAvailableException(e)) { return; if (TransportActions.isReadOverrideException(e)) { shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
successfulShards += response.getSuccessfulShards(); for (BroadcastShardOperationFailedException throwable : response.getExceptions()) { if (!TransportActions.isShardNotAvailableException(throwable)) { exceptions.add(new DefaultShardOperationFailedException(throwable.getShardId().getIndexName(), throwable.getShardId().getId(), throwable));
public final void onShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Exception e) { if (TransportActions.isShardNotAvailableException(e) == false) { AtomicArray<ShardSearchFailure> shardFailures = this.shardFailures.get(); if (TransportActions.isReadOverrideException(e)) { shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
@Override public void onFailure(Exception e) { logger.trace("{}: got failure from {}", actionName, shardId); int totalNumCopies = clusterState.getMetaData().getIndexSafe(shardId.getIndex()).getNumberOfReplicas() + 1; ShardResponse shardResponse = newShardResponse(); ReplicationResponse.ShardInfo.Failure[] failures; if (TransportActions.isShardNotAvailableException(e)) { failures = new ReplicationResponse.ShardInfo.Failure[0]; } else { ReplicationResponse.ShardInfo.Failure failure = new ReplicationResponse.ShardInfo.Failure(shardId, null, e, ExceptionsHelper.status(e), true); failures = new ReplicationResponse.ShardInfo.Failure[totalNumCopies]; Arrays.fill(failures, failure); } shardResponse.setShardInfo(new ReplicationResponse.ShardInfo(totalNumCopies, 0, failures)); shardsResponses.add(shardResponse); if (responsesCountDown.countDown()) { finishAndNotifyListener(listener, shardsResponses); } } };
public final void onShardFailure(final int shardIndex, @Nullable SearchShardTarget shardTarget, Exception e) { if (TransportActions.isShardNotAvailableException(e) == false) { AtomicArray<ShardSearchFailure> shardFailures = this.shardFailures.get(); if (TransportActions.isReadOverrideException(e)) { shardFailures.set(shardIndex, new ShardSearchFailure(e, shardTarget));
if (e != null && !TransportActions.isShardNotAvailableException(e)) { logger.debug(new ParameterizedMessage( "{}: Failed to execute [{}]", shard != null ? shard.shortSummary() : shardIt.shardId(), request), e); if (e != null && !TransportActions.isShardNotAvailableException(e)) { logger.debug(new ParameterizedMessage( "{}: Failed to execute [{}] lastShard [{}]",
/** * If a failure is already present, should this failure override it or not for read operations. */ public static boolean isReadOverrideException(Exception e) { return !isShardNotAvailableException(e); }
/** * If a failure is already present, should this failure override it or not for read operations. */ public static boolean isReadOverrideException(Exception e) { return !isShardNotAvailableException(e); }
@Override protected boolean retryOnFailure(Exception e) { return TransportActions.isShardNotAvailableException(e); }
/** * If a failure is already present, should this failure override it or not for read operations. */ public static boolean isReadOverrideException(Throwable t) { if (isShardNotAvailableException(t)) { return false; } return true; } }
@Override protected boolean retryOnFailure(Exception e) { return TransportActions.isShardNotAvailableException(e); }
/** * If a failure is already present, should this failure override it or not for read operations. */ public static boolean isReadOverrideException(Exception e) { return !isShardNotAvailableException(e); }
@Override protected boolean retryOnFailure(Exception e) { return TransportActions.isShardNotAvailableException(e); }
@Override protected boolean retryOnFailure(Throwable e) { return TransportActions.isShardNotAvailableException(e); }