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

Deleted docs disregarded for if_seq_no check #50526

Merged

Conversation

henningandersen
Copy link
Contributor

@henningandersen henningandersen commented Dec 30, 2019

Previously, as long as a deleted version value was kept as a tombstone,
another index or delete operation against the same id would leak that
the doc had existed (through seq_no info) or would allow the operation
if the client forged the seq_no. Fixed to disregard info on deleted docs
when doing seq_no based optimistic concurrency check.

AFAICS the use of the tombstones/gc_deletes period is only relevant to
external versioning.

Previously, as long as a deleted version value was kept as a tombstone,
another index or delete operation against the same id would leak that
the doc had existed (through seq_no info) or would allow the operation
if the client forged the seq_no (which in principle could be a dirty
read). Fixed to disregard info on deleted docs when doing optimistic
concurrency check.
@henningandersen henningandersen added >enhancement :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v8.0.0 v7.6.0 labels Dec 30, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Engine)

A test would utilize that conditional delete or index on seq-nos that
no longer exists (but is still in version map) works.
UpdateSettingsIT used seq_no to validate index.gc_deletes. This is no
longer possible (with this PR) and we instead use external versioning,
which seems to be the only valid use case for triggering on tombstones.

SimpleVersioningIT was fixed since a conditional delete against a
deleted doc now fails.
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. The fix makes sense to me. Thanks Henning. How did you find this issue (just curious)?

@henningandersen
Copy link
Contributor Author

henningandersen commented Jan 3, 2020

Thanks for reviewing @dnhatn

How did you find this issue (just curious)?

I was helping debugging a REST test where a conditional index operation failed with a message saying that the current seq-no was different from the if-seq-no. This led us down a path of investigating why the doc was updated, but it turned out it was indeed deleted. I opened this PR primarily to avoid that confusion.

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

LGTM

@henningandersen henningandersen merged commit fdd4133 into elastic:master Jan 6, 2020
henningandersen added a commit that referenced this pull request Jan 6, 2020
Previously, as long as a deleted version value was kept as a tombstone,
another index or delete operation against the same id would leak that
the doc had existed (through seq_no info) or would allow the operation
if the client forged the seq_no. Fixed to disregard info on deleted docs
when doing seq_no based optimistic concurrency check.
@henningandersen
Copy link
Contributor Author

Thanks for the reviews, Nhat and Yannick.

SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
Previously, as long as a deleted version value was kept as a tombstone,
another index or delete operation against the same id would leak that
the doc had existed (through seq_no info) or would allow the operation
if the client forged the seq_no. Fixed to disregard info on deleted docs
when doing seq_no based optimistic concurrency check.
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. >enhancement v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants