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: more directly init the timestamps in EvalCtx
... and also make session.newPlanner() not need an Executor any more. The initialization of the timestamp fields in the EvalContext was pretty scattered. I've centralized it now in the ctor. The places where these fields are not initialized are now more visible. This commit does not change any behavior. As a reminder, there's three timestamps that power SQL builtin functions: - evalCtx.StmtTimestamp powers statement_timestamp() - evalCtx.TxnTimestamp powers now(), current_timestamp() and transaction_timestamp() - txnProto.OrigTimestamp powers cluster_logical_timestamp() TxnTimestamp is reset by the Executor whenever a new SQL transaction starts. It is *not* reset on transaction restarts, automatic or user-directed. StmtTimestamp is reset before planning/preparing/executing each statement. A while ago I believe a couple of us agreed that the fact that TxnTimestamp is not reset on restarts was a mistake. Resetting it would bring now() closer to cluster_logical_timestamp(), guaranteeing that for conflicting txns, the results of now() would be ordered as the transactions were. This remanins to be done in another PR. release note: none
- Loading branch information
1 parent
6385024
commit a46b0a0
Showing
6 changed files
with
76 additions
and
56 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