-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add tidb_low_resolution_tso session scope variable on master #10428
Add tidb_low_resolution_tso session scope variable on master #10428
Conversation
Low resolution timestamp is updated once every two seconds which can be used if reading slightly old version of data is acceptable. Like tidb_snapshot read, transaction is readonly when tidb_low_resolution_tso is enabled. Signed-off-by: Xiaoguang Sun <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #10428 +/- ##
===========================================
Coverage ? 77.2622%
===========================================
Files ? 413
Lines ? 86992
Branches ? 0
===========================================
Hits ? 67212
Misses ? 14615
Partials ? 5165 |
type lowResolutionTsFuture uint64 | ||
|
||
// Wait implements the oracle.Future interface. | ||
func (f lowResolutionTsFuture) Wait() (uint64, error) { |
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.
how about abbreviate Resolution
to Rez
or Reso
? Found in https://www.abbreviations.com/abbreviation/RESOLUTION
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.
It does look verbose now. But i'm not sure about Rez, looks strange to me though. Let's see what other people think about 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.
I prefer to keep the whole word.
@@ -140,3 +140,21 @@ func (o *pdOracle) updateTS(ctx context.Context, interval time.Duration) { | |||
func (o *pdOracle) Close() { | |||
close(o.quit) | |||
} | |||
|
|||
type lowResolutionTsFuture uint64 |
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.
please add some comment about this future.
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.
Fixed
Signed-off-by: Xiaoguang Sun <[email protected]>
Signed-off-by: Xiaoguang Sun <[email protected]>
It's strange that I have signed CLA however it kept complaining it's not done yet. |
Finally got CLA passed after merging master |
/run-all-tests |
LGTM |
Signed-off-by: Xiaoguang Sun <[email protected]>
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.
LGTM
Low resolution timestamp is updated once every two seconds which can be used if reading slightly old version of data is acceptable. Like tidb_snapshot read, transaction is readonly when tidb_low_resolution_tso is enabled.
What problem does this PR solve?
Introduce a session scope variable tidb_low_resolution_tso which can use periodically updated
timestamp from TSO when transaction starts. This can save one TSO request roundtrip time per transaction which is beneficial for small readonly queries in terms of latency. As a side effect, there will be less TSO requests hence less pressure on PD.
What is changed and how it works?
Add a new tidb_low_resolution_tso session scope variable. When transaction starts and about to get start timestamp from TSO, call low resolution timestamp interface when tidb_low_resolution_tso is enabled. Like tidb_snapshot read, transaction is readonly when tidb_low_resolution_tso is enabled.
Tests
Related changes