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

Use sequences numbers for Compare and Set operations #26493

Closed
bleskes opened this issue Sep 4, 2017 · 6 comments
Closed

Use sequences numbers for Compare and Set operations #26493

bleskes opened this issue Sep 4, 2017 · 6 comments
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. high hanging fruit

Comments

@bleskes
Copy link
Contributor

bleskes commented Sep 4, 2017

Elasticsearch currently supports CAS operations (needed for optimistic concurrency) using a document _version field. Sadly this is not water tight and can go wrong if a primary fails between the read and the CAS write operation. To remedy this we need to move to using a document's _seq_no and _primary_term fields as an identifier for CAS operations.

To do so we will add two parameters to write operations - _expected_seq_no and _expected_primary_term. When set, those parameters will require the document to have exactly the expected values in the respective fields for a successful write.

Note that this can co-exists with the the current _version based method, which we can phase out or make optional later on.

Relates #10708

@dnhatn
Copy link
Member

dnhatn commented Sep 26, 2017

Hi @jasontedor, I am thinking to work on this. What do you think? Thank you.

@jasontedor
Copy link
Member

@dnhatn I think we can get there, but let’s work our ways towards it.

@DaveCTurner
Copy link
Contributor

Just registering my interest in this too @dnhatn. Please ping me if you're discussing this.

@dnhatn
Copy link
Member

dnhatn commented Sep 27, 2017

@DaveCTurner Sure.

@jasontedor
Copy link
Member

Let’s return to this one in the future after we have addressed some other issues first.

@dnhatn dnhatn self-assigned this Oct 24, 2017
@dnhatn dnhatn removed the help wanted adoptme label Oct 24, 2017
dnhatn added a commit to dnhatn/elasticsearch that referenced this issue Oct 30, 2017
Currently, we are using _version for CAS operations. However, using _version
alone does not guarantee the uniqueness during a network partition.  To remedy
the issue, we recommend using a combination of _version and _primary_term for
CAS operations.

This is the first step towards that goal. In this change, we return
_primary_term for GET and MGET requests.

Relates elastic#26493
@clintongormley clintongormley added :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Sequence IDs labels Feb 14, 2018
@dnhatn dnhatn removed their assignment Apr 26, 2018
@dnhatn
Copy link
Member

dnhatn commented Feb 27, 2019

@bleskes has completed this in #36467 and the related PRs.

@dnhatn dnhatn closed this as completed Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. high hanging fruit
Projects
None yet
Development

No branches or pull requests

5 participants