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
Core: create operation on replica should not throw DocumentAlreadyExistsException #7142
Labels
Comments
mikemccand
added a commit
that referenced
this issue
Aug 4, 2014
…nconsistent replica If simultaneous create & delete operations arrive against the same id, it's possible that primary and replica see those operations in different orders, which may result in replica throwing DocumentAlreadyExistsException when the primary didn't which would lead to replica being inconsistent (missing a document that primary had indexed). This push fixes the issue, by never throwing DAEE from the replica on create. Closes #7146 #7142
mikemccand
added a commit
that referenced
this issue
Aug 4, 2014
…nconsistent replica If simultaneous create & delete operations arrive against the same id, it's possible that primary and replica see those operations in different orders, which may result in replica throwing DocumentAlreadyExistsException when the primary didn't which would lead to replica being inconsistent (missing a document that primary had indexed). This push fixes the issue, by never throwing DAEE from the replica on create. Closes #7146 #7142
mikemccand
changed the title
Create operation on replica should not throw DocumentAlreadyExistsException
Core: create operation on replica should not throw DocumentAlreadyExistsException
Aug 6, 2014
mikemccand
added a commit
that referenced
this issue
Aug 6, 2014
…nconsistent replica If simultaneous create & delete operations arrive against the same id, it's possible that primary and replica see those operations in different orders, which may result in replica throwing DocumentAlreadyExistsException when the primary didn't which would lead to replica being inconsistent (missing a document that primary had indexed). This push fixes the issue, by never throwing DAEE from the replica on create. Closes #7146 #7142
mikemccand
added a commit
that referenced
this issue
Sep 8, 2014
…nconsistent replica If simultaneous create & delete operations arrive against the same id, it's possible that primary and replica see those operations in different orders, which may result in replica throwing DocumentAlreadyExistsException when the primary didn't which would lead to replica being inconsistent (missing a document that primary had indexed). This push fixes the issue, by never throwing DAEE from the replica on create. Closes #7146 #7142
mute
pushed a commit
to mute/elasticsearch
that referenced
this issue
Jul 29, 2015
…nconsistent replica If simultaneous create & delete operations arrive against the same id, it's possible that primary and replica see those operations in different orders, which may result in replica throwing DocumentAlreadyExistsException when the primary didn't which would lead to replica being inconsistent (missing a document that primary had indexed). This push fixes the issue, by never throwing DAEE from the replica on create. Closes elastic#7146 elastic#7142
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a create operation, today we (by design) throw DAEE if the given _uid is already present in the index, even if its version is "old".
But when there are concurrent operations in flight against the same _uid this can be wrong, and was causing [rare] failures in SimpleVersioningTests.testRandomIDsAndVersions... the specific case was a given _uid was already in the index, and then a delete op (with higher version), and a create op (with higher version still) were issued concurrently.
On primary, the delete came first, succeeded, and then the create came second, and it succeeded. But on the replica, the create came first, and it threw DAEE (which we intentionally suppress & don't throw back to user), then the delete came, and it succeeded, leaving primary & replica silently out-of-sync.
To fix this, for a create op, if we are a replica, we should not throw DAEE: it means the primary has already decided the document should be indexed. Instead, we should fallback to the same logic index operation does, making sure the version is newer, and we must use IW.updateDocument/s in this case since the doc is in the index with an older version. We can still use the auto-gen'd ID optimization...
The text was updated successfully, but these errors were encountered: