Skip to content
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

Merged
merged 1 commit into from Sep 8, 2015

Conversation

brwe
Copy link
Contributor

@brwe brwe commented Sep 7, 2015

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.

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) {
Copy link
Contributor

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);
        }

Copy link
Contributor

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

@bleskes
Copy link
Contributor

bleskes commented Sep 8, 2015

Thx @brwe . Left some comments

@brwe brwe force-pushed the exception-on-force-merge branch 3 times, most recently from d912267 to f2777bd Compare September 8, 2015 12:23
@brwe
Copy link
Contributor Author

brwe commented Sep 8, 2015

@bleskes @s1monw thanks for the review! addressed all comments.

@@ -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);
Copy link
Contributor

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.

@bleskes
Copy link
Contributor

bleskes commented Sep 8, 2015

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.
brwe added a commit that referenced this pull request Sep 8, 2015
Engine: Let AlreadyClosedException and EngineClosedExceptionBubble up
@brwe brwe merged commit 3de8cbb into elastic:master Sep 8, 2015
@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Engine labels Feb 13, 2018
@clintongormley clintongormley removed the :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. label Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. v2.0.0-beta2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants