-
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
Add tidb_low_resolution_tso session scope variable on master #10428
Changes from all commits
368e8a9
e266d7c
bc79d29
c58c7dd
8001e00
b2e5d40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,3 +146,22 @@ func (o *pdOracle) UntilExpired(lockTS uint64, TTL uint64) int64 { | |
func (o *pdOracle) Close() { | ||
close(o.quit) | ||
} | ||
|
||
// A future that resolves immediately to a low resolution timestamp. | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. how about abbreviate 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. 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 commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to keep the whole word. |
||
return uint64(f), nil | ||
} | ||
|
||
// GetLowResolutionTimestamp gets a new increasing time. | ||
func (o *pdOracle) GetLowResolutionTimestamp(ctx context.Context) (uint64, error) { | ||
lastTS := atomic.LoadUint64(&o.lastTS) | ||
return lastTS, nil | ||
} | ||
|
||
func (o *pdOracle) GetLowResolutionTimestampAsync(ctx context.Context) oracle.Future { | ||
lastTS := atomic.LoadUint64(&o.lastTS) | ||
return lowResolutionTsFuture(lastTS) | ||
} |
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