-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
129547: kv,storage: add new OriginTimestamp option to ConditionalPut r=tbg a=stevendanna To improve the performance of the logical replication ingestion processor, we would like to be able to manually generate KV batches rather than writing via SQL. However, we also only want to write an ingested row if it is clearly newer than an existing row. Two new ConditionaPutRequest parameters allow for this: - `OriginTimestamp`: When set, any existing value must be older than this timestamp. The time comparison is made against the OriginTimestamp field in the values MVCCValueHeader if it is set or the keys MVCCTimestamp if it isn't. - `ShouldWinOriginTimestampTie`: When true, indicates that the proposed value should be accepted even the inbound OriginTimestamp is exactly equal to the existing value's timestamp. Additionally, two new error states have been added to ConditionFailedError: - `OriginTimestampOlderThan`: An error with this value set indicates that the ConditionalPutRequest failed because its OriginTimestamp was too old. - `HadNewerOriginTimestamp`: When set, this indicates that while the expected value did not match the existing value, the provided origin timestamp was newer. The expectation is that callers who receive an error with OriginTimestampOlderThan may abort their transaction and not attempt a retry because their proposed value is too old. A caller who gets an error with HadNewerOriginTimestamp may choose to abort their transaction but retry with the value provided in the ActualValue field. Note a value expectation mismatch is likely for our proposed caller who is constructing its expected values using rangefeed events from another table. Epic: none Release note: None 130908: rac2: send-queue tracking in push mode r=kvoli a=sumeerbhola The new raftEventForReplica encapsulates all that is needed to handle the RaftEvent, including (re)creating a replicaSendStream. The complexity is encapsulated in the construction of this event, which also pays attention to regressions, jumps, and other anomalies, all of which cause the existing replicaSendStream (if any) to be recreated. The recreaton is a significant simplification from the prototype, which was doing unnecessarily complicated work in fixing up the state. The send-queue tracking is simple, [indexToSend, nextRaftIndex). Since there is a send-queue, we separately track the eval.tokensDeducted counts. Tracker.UntrackGE is no longer needed, which is another simplification. Epic: CRDB-37515 Informs #123509 Release note: None Co-authored-by: Steven Danna <[email protected]> Co-authored-by: sumeerbhola <[email protected]> Co-authored-by: Austen McClernon <[email protected]>
- Loading branch information
Showing
31 changed files
with
2,432 additions
and
789 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
Oops, something went wrong.