New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Engine: Let AlreadyClosedException and EngineClosedExceptionBubble up #13380
Conversation
throw ex; | ||
maybeFailEngine("force merge", new ForceMergeFailedEngineException(shardId, t)); | ||
// wrap things we don't know in a ForceMergeFailedEngineException but let exceptions that indicate a closed shard bubble up | ||
if (t instanceof AlreadyClosedException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put it in their own catch clause similar in how it's done in refresh:
} catch (AlreadyClosedException e) {
ensureOpen();
maybeFailEngine("refresh", e);
} catch (EngineClosedException e) {
throw e;
} catch (Throwable t) {
failEngine("refresh failed", t);
throw new RefreshFailedEngineException(shardId, t);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just rethrow t
and remove that exception. We can't handle this just like refresh since a failing refresh means dataloss while this one might just be a configuration issue or so. We should just pass t to maybeFailEngine
and rethrow IMO
Thx @brwe . Left some comments |
d912267
to
f2777bd
Compare
@@ -865,9 +866,8 @@ public void forceMerge(final boolean flush, int maxNumSegments, boolean onlyExpu | |||
store.decRef(); | |||
} | |||
} catch (Throwable t) { | |||
ForceMergeFailedEngineException ex = new ForceMergeFailedEngineException(shardId, t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can delete ForceMergeFailedEngineException now, right? It's not used.
Cool. LGTM. left some minor comments - no need for another cycle as far as I'm concerned. |
Whe we call optimize we ignore Exceptions that indicate a closed shard. However, when a shard is closed while an optimize request is in flight it might also trigger an AlreadyClosedException from the IndexWriter when we get the config or ForceMergeFailedEngineException with the EngineClosedException wrapped inside. Because these are not identified as exceptions that indicate a closed shard (TransportActions.isShardNotAvailableException(..)) optimize would sometimes report failures when shards were relocating while optimize was called and sometimes not. This caused weird test failures, see elastic#13266 . Instead, we should let EngineClosedException bubble up and also recognize AlreadyClosedException as an indicator for a closed shard.
f2777bd
to
2288d44
Compare
Engine: Let AlreadyClosedException and EngineClosedExceptionBubble up
Whe we call optimize we ignore Exceptions that indicate a closed shard.
However, when a shard is closed while an optimize request is in flight it
might also trigger an AlreadyClosedException from the IndexWriter when we
get the config or ForceMergeFailedEngineException with the EngineClosedException
wrapped inside. Because these are not identified as exceptions that indicate
a closed shard (TransportActions.isShardNotAvailableException(..)) optimize
would sometimes report failures when shards were relocating while optimize was called
and sometimes not. This caused weird test failures, see #13266 .
Instead, we should let EngineClosedException bubble up and also recognize
AlreadyClosedException as an indicator for a closed shard.