forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DNM] enginepb: strongly type enginepb.TxnTimestamp, split from hlc.T…
…imestamp This commit splits off a new enginepb.TxnTimestamp type (see `pkg/storage/enginepb/mvcc.go`) from the existing hlc.Timestamp type through a type alias. While the two types share the same memory and proto representation, they have different purposes and properties. hlc.Timestamp continues to serve in its original role — representing a real timestamp pulled from a clock on one of the nodes in the system. enginepb.TxnTimestamp is introduced to serve in hlc.Timestamp's current secondary role – representing MVCC time and the time that transactions read and write at. In the words of cockroachdb#56373 (review), this splits "clock-domain timestamps" from "transaction-domain timestamps", allowing us to use to type system to help keep them separate and to make their interactions more explicit. This results in boiling most of the ocean, but comes with some benefits in the end. - It makes conversion from the clock-domain to the transaction-domain explicit. This must pass through a call to `enginepb.ToTxnTimestamp`. - It makes conversions from the transaction-domain to the clock-domain impossible (not quite there yet). - Similarly, it makes it impossible for transaction-domain timestamps to be passed into `hlc.Clock.Update`. - It allows us to more clearly state that clock-domain timestamps must always trail present time but transaction-domain timestamps can move into the future. As such, only transaction-domain timestamps will ever have the synthetic bit set. I'm interested to get people's take on this. These benefits are nice, but the size of this diff (it still doesn't come close to compiling) and the newly introduced burden of needing to choose between multiple timestamp types is not.
- Loading branch information
1 parent
cea9423
commit a144eb8
Showing
177 changed files
with
3,429 additions
and
3,223 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
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
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.