Skip to content

[CCR] Improve error when operations are missing #35179

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

Merged
merged 2 commits into from
Nov 6, 2018

Conversation

martijnvg
Copy link
Member

No description provided.

@martijnvg martijnvg added >non-issue :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features labels Nov 1, 2018
@martijnvg martijnvg requested a review from jasontedor November 1, 2018 19:25
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @martijnvg. I left a comment to discuss.

@@ -84,4 +87,32 @@ public void testGetOperationsBasedOnGlobalSequenceId() throws Exception {
assertThat(operation.id(), equalTo("5"));
}

public void testMissingOperations() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test 👍

protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
ActionListener<Response> wrappedListener = ActionListener.wrap(listener::onResponse, e -> {
Throwable cause = ExceptionsHelper.unwrapCause(e);
if (cause instanceof IllegalStateException && cause.getMessage().contains("Not all operations between from_seqno [")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this change but I prefer to narrow the scope. How about catching and converting the exception with the existing try in ShardChangesAction#getOperations? I am thinking to have a dedicated exception so that we can access "fromSeqNo" and "toSeqNo" but maybe overkilled. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking to have a dedicated exception so that we can access "fromSeqNo" and "toSeqNo" but maybe overkilled.

We should not introduce that dedicated exception I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this change but I prefer to narrow the scope. How about catching and converting the exception with the existing try in ShardChangesAction#getOperations

I think converting the exception there is premature. If a replica shard copy is queried, it may not have all the operations, but another shard may have it, so the shard changes api can retry it on another shard copy. Then the exception convertion was not needed, since the shard changes api was able to serve the request after all.

When we intercept the exception at the place were the exception conversion is now, we know that the shard changes has attempted the read the range of operations on all shard copies, but still wasn't able to satisfy the request.

I am thinking to have a dedicated exception so that we can access "fromSeqNo" and "toSeqNo" but maybe overkilled. WDYT?

I was considering this, because the way we detect this kind of error is weak (instance of IllegalStateException AND the exception message containing a specific message). What about throwing an EngineException with two headers (from and to seqno) in LuceneChangesSnapshot#rangeCheck(...)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. Let's do it here. Since the error has an inner cause which provides from_seq_no and to_seq_no information, I think we are good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+100 to any way that doesn't rely on message strings. Thanks for iterating on this to get there!

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@martijnvg martijnvg merged commit 46c238d into elastic:master Nov 6, 2018
martijnvg added a commit that referenced this pull request Nov 6, 2018
Improve error when operations are missing
martijnvg added a commit that referenced this pull request Nov 6, 2018
Improve error when operations are missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CCR Issues around the Cross Cluster State Replication features >non-issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants