-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Close Index API should force a flush if a sync is needed #37961
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tlrx
added
>bug
v7.0.0
:Distributed Indexing/Distributed
A catch all label for anything in the Distributed Area. Please avoid if you can.
v6.7.0
labels
Jan 29, 2019
Pinging @elastic/es-distributed |
ywelsch
approved these changes
Jan 29, 2019
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.
LGTM
Thanks @ywelsch |
tlrx
added a commit
that referenced
this pull request
Jan 29, 2019
This commit changes the TransportVerifyShardBeforeCloseAction so that it issues a forced flush, forcing the translog and the Lucene commit to contain the same max seq number and global checkpoint in the case the Translog contains operations that were not written in the IndexWriter (like a Delete that touches a non existing doc). This way the assertion added in #37426 won't trip. Related to #33888
tlrx
added a commit
that referenced
this pull request
Feb 6, 2019
This commit changes the `TransportVerifyShardBeforeCloseAction` so that it always forces the flush of the shard. It seems that #37961 is not sufficient to ensure that the translog and the Lucene commit share the exact same max seq no and global checkpoint information in case of one or more noop operations have been made. The `BulkWithUpdatesIT.testThatMissingIndexDoesNotAbortFullBulkRequest` and `FrozenIndexTests.testFreezeEmptyIndexWithTranslogOps` test this trivial situation and they both fail 1 on 10 executions. Relates to #33888
tlrx
added a commit
to tlrx/elasticsearch
that referenced
this pull request
Feb 6, 2019
…8401) This commit changes the `TransportVerifyShardBeforeCloseAction` so that it always forces the flush of the shard. It seems that elastic#37961 is not sufficient to ensure that the translog and the Lucene commit share the exact same max seq no and global checkpoint information in case of one or more noop operations have been made. The `BulkWithUpdatesIT.testThatMissingIndexDoesNotAbortFullBulkRequest` and `FrozenIndexTests.testFreezeEmptyIndexWithTranslogOps` test this trivial situation and they both fail 1 on 10 executions. Relates to elastic#33888
tlrx
added a commit
that referenced
this pull request
Feb 6, 2019
This commit changes the `TransportVerifyShardBeforeCloseAction` so that it always forces the flush of the shard. It seems that #37961 is not sufficient to ensure that the translog and the Lucene commit share the exact same max seq no and global checkpoint information in case of one or more noop operations have been made. The `BulkWithUpdatesIT.testThatMissingIndexDoesNotAbortFullBulkRequest` and `FrozenIndexTests.testFreezeEmptyIndexWithTranslogOps` test this trivial situation and they both fail 1 on 10 executions. Relates to #33888
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
>bug
:Distributed Indexing/Distributed
A catch all label for anything in the Distributed Area. Please avoid if you can.
v6.7.0
v7.0.0-beta1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working in #33888 I stumbled upon a trivial test case in which a no-op delete operation is executed on an empty index and this index is later closed and reopened as frozen, making the assertion added in #37426 to trip:
The assertion trips because the Translog is synced with max seq=X and global checkpoint=Y but those information are not flushed into the Lucene commit as no real operation has been executed and the IndexWriter has no uncommited changes.
The flushes executed by
TransportVerifyShardBeforeCloseAction
andIndexShard.close()
won't persist the max seq no and global checkpoint in the Lucene commit, and when the ReadOnlyEngine is opened it will reload max seq no from the last Lucene commit and will detect a mismatch with the global checkpoint loaded from the translog.This pull request changes the
TransportVerifyShardBeforeCloseAction
so that it forces a flush when the Translog.isSyncNeeded() method returns true, indicating that the global checkpoint != the last synced globalcheckpoint and also forces a Lucene commit with the same user data. Or we could always force the flush too.