Add doc's sequence number + primary term to GetResult and use it for updates#36680
Add doc's sequence number + primary term to GetResult and use it for updates#36680bleskes merged 7 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-distributed |
dnhatn
left a comment
There was a problem hiding this comment.
LGTM. I left some minor comments.
...java/org/elasticsearch/xpack/watcher/transport/actions/ack/TransportAckWatchActionTests.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/get/GetResult.java
Outdated
Show resolved
Hide resolved
dnhatn
left a comment
There was a problem hiding this comment.
LGTM. I like the way you break into smaller PRs. They are contained and easy to review :).
| } | ||
|
|
||
| /** | ||
| * The primary term of the last primary that have changed this document, if found. |
| getResult.isExists(),getResult.internalSourceRef(), getResult.getFields())); | ||
| update.setGetResult(new GetResult(update.getIndex(), update.getType(), update.getId(), | ||
| getResult.getSeqNo(), getResult.getPrimaryTerm(), update.getVersion(), | ||
| getResult.isExists(),getResult.internalSourceRef(), getResult.getFields())); |
| update.setGetResult(new GetResult(update.getIndex(), update.getType(), update.getId(), update.getVersion(), | ||
| getResult.isExists(),getResult.internalSourceRef(), getResult.getFields())); | ||
| update.setGetResult(new GetResult(update.getIndex(), update.getType(), update.getId(), | ||
| getResult.getSeqNo(), getResult.getPrimaryTerm(), update.getVersion(), |
There was a problem hiding this comment.
Why do we use the seq-no and primary term from getResult whereas we use the version from update?
There was a problem hiding this comment.
I saw the too and tried to change it but tests fail. IMO it's a bug but I chose not to fix it in this PR / break BWC.
| this.id = id; | ||
| this.seqNo = seqNo; | ||
| this.primaryTerm = primaryTerm; | ||
| assert (seqNo == SequenceNumbers.UNASSIGNED_SEQ_NO && primaryTerm == 0) || (seqNo >= 0 && primaryTerm >= 1) : |
There was a problem hiding this comment.
should we add a new UNASSIGNED_PRIMARY_TERM constant? There are too many of these magic 0 terms sprinkled all over.
There was a problem hiding this comment.
+1 here too, for a long time. I don't want to pollute this PR as it will be big and holds to more places. I can do it as a follow up.
* master: (30 commits) Revert "[Geo] Integrate Lucene's LatLonShape (BKD Backed GeoShapes) as default `geo_shape` indexing approach (elastic#35320)" Deprecate types in get_source and exist_source (elastic#36426) Fix duplicate phrase in shrink/split error message (elastic#36734) ingest: support default pipelines + bulk upserts (elastic#36618) TESTS:Debug Log. IndexStatsIT#testFilterCacheStats [Geo] Integrate Lucene's LatLonShape (BKD Backed GeoShapes) as default `geo_shape` indexing approach (elastic#35320) [TEST] fix float comparison in RandomObjects#getExpectedParsedValue Initialize startup `CcrRepositories` (elastic#36730) ingest: fix on_failure with Drop processor (elastic#36686) SNAPSHOTS: Adjust BwC Versions in Restore Logic (elastic#36718) [Painless] Add boxed type to boxed type casts for method/return (elastic#36571) Do not resolve addresses in remote connection info (elastic#36671) Add back one line removed by mistake regarding java version check and COMPAT jvm parameter existence Fixing line length for EnvironmentTests and RecoveryTests (elastic#36657) SQL: Fix translation of LIKE/RLIKE keywords (elastic#36672) [DOCS] Adds monitoring requirement for ingest node (elastic#36665) SNAPSHOTS: Disable BwC Tests Until elastic#36659 Landed (elastic#36709) Add doc's sequence number + primary term to GetResult and use it for updates (elastic#36680) [CCR] Add time since last auto follow fetch to auto follow stats (elastic#36542) Watcher accounts constructed lazily (elastic#36656) ...
This PR adds the last sequence number and primary term of the last operation that have modified a document to
GetResultand uses it to power the Update API.Relates #36148
Relates #10708