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.
sql,sqlbase,client: bootstrap TableDescriptor timestamps from MVCC
Using the MVCC timestamp of the value for table descriptors has long been theorized as the right mechanism to eliminate the need for transactions which update a table descriptor version to observe their commit timestamp (see cockroachdb#17698 (comment)). The challenge was presumed to be the need to expose MVCC timestamps in our client library. It turns out we seem to do that already (how did nobody know that?!). This commit avoids using the CommitTimestamp by using the MVCC timestamp on the read path. In order to make this setting of the timestamp less of a footgun we add a `(*Descriptor).Table(hlc.Timestamp)` method which forces anybody who extracts a `TableDescriptor` from a `Descriptor` to pass in a timestamp which may be used to set `ModificationTime` and `CreateAsOfTime`. A linter in the following commit enforces this proper usage. The below SQL would always fail before this change and now passes: ``` CREATE TABLE foo ( k INT PRIMARY KEY ); BEGIN; DROP TABLE foo; <wait a while> COMMIT; ``` Similarly the TestImportData seems to pass under stressrace with a 5s `kv.closed_timestamp.target_duration`. Release justification: fixes a release blocker and known customer issue. References cockroachdb#37083. Release note: None
- Loading branch information
Showing
44 changed files
with
508 additions
and
230 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
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.