-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Seq# based optimistic concurrency control to UpdateRequest (#37872)
The update request has a lesser known support for a one off update of a known document version. This PR adds an a seq# based alternative to power these operations. Relates #36148 Relates #10708
- Loading branch information
Showing
20 changed files
with
450 additions
and
77 deletions.
There are no files selected for viewing
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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
rest-api-spec/src/main/resources/rest-api-spec/test/update/35_if_seq_no.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
"Update with if_seq_no": | ||
|
||
- skip: | ||
version: " - 6.99.99" | ||
reason: if_seq_no was added in 7.0 | ||
|
||
- do: | ||
catch: missing | ||
update: | ||
index: test_1 | ||
id: 1 | ||
if_seq_no: 1 | ||
if_primary_term: 1 | ||
body: | ||
doc: { foo: baz } | ||
|
||
- do: | ||
index: | ||
index: test_1 | ||
id: 1 | ||
body: | ||
foo: baz | ||
|
||
- do: | ||
catch: conflict | ||
update: | ||
index: test_1 | ||
id: 1 | ||
if_seq_no: 234 | ||
if_primary_term: 1 | ||
body: | ||
doc: { foo: baz } | ||
|
||
- do: | ||
update: | ||
index: test_1 | ||
id: 1 | ||
if_seq_no: 0 | ||
if_primary_term: 1 | ||
body: | ||
doc: { foo: bar } | ||
|
||
- do: | ||
get: | ||
index: test_1 | ||
id: 1 | ||
|
||
- match: { _source: { foo: bar } } | ||
|
||
- do: | ||
bulk: | ||
body: | ||
- update: | ||
_index: test_1 | ||
_id: 1 | ||
if_seq_no: 100 | ||
if_primary_term: 200 | ||
- doc: | ||
foo: baz | ||
|
||
- match: { errors: true } | ||
- match: { items.0.update.status: 409 } | ||
|
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
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
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
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
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
Oops, something went wrong.