-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
executor: implement set transaction read only as of transaction #24766
Merged
ti-chi-bot
merged 13 commits into
pingcap:master
from
Yisaer:support_set_transaction_read_only_as_of
May 25, 2021
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
72498dd
support set transaction
Yisaer 21871cd
address the comment
Yisaer 7f7643f
Merge remote-tracking branch 'upstream/master' into support_set_trans…
Yisaer 8e32482
fix test
Yisaer 9395162
Merge remote-tracking branch 'upstream/master' into support_set_trans…
Yisaer 900cf31
Merge remote-tracking branch 'upstream/master' into support_set_trans…
Yisaer b0fe8e2
address the comment
Yisaer ce2df75
address the comment
Yisaer 5c4ffda
Merge remote-tracking branch 'upstream/master' into support_set_trans…
Yisaer 6c938a7
address the comment
Yisaer 3c465d0
fix test
Yisaer 29b8389
Merge branch 'master' into support_set_transaction_read_only_as_of
ti-chi-bot a72892a
Merge branch 'master' into support_set_transaction_read_only_as_of
ti-chi-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,6 +465,23 @@ func setSnapshotTS(s *SessionVars, sVal string) error { | |
return err | ||
} | ||
|
||
func setTxnReadTS(s *SessionVars, sVal string) error { | ||
if sVal == "" { | ||
s.TxnReadTS = 0 | ||
return nil | ||
} | ||
t, err := types.ParseTime(s.StmtCtx, sVal, mysql.TypeTimestamp, types.MaxFsp) | ||
if err != nil { | ||
return err | ||
} | ||
t1, err := t.GoTime(s.TimeZone) | ||
if err != nil { | ||
return err | ||
} | ||
s.TxnReadTS = GoTimeToTS(t1) | ||
return err | ||
} | ||
|
||
// GoTimeToTS converts a Go time to uint64 timestamp. | ||
func GoTimeToTS(t time.Time) uint64 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function is duplicated with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated. |
||
ts := (t.UnixNano() / int64(time.Millisecond)) << epochShiftBits | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this sysvar exposed to users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is ok to exposed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, users may also use this variable to set read ts.