-
Notifications
You must be signed in to change notification settings - Fork 225
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
min-safe-ts: fix MinSafeTS might be set to MaxUint64 permanently #994
Conversation
d927476
to
cb3ce6c
Compare
Signed-off-by: husharp <[email protected]>
cb3ce6c
to
aa81be7
Compare
@JmPotato PTAL, thx! |
tikv/kv.go
Outdated
if val.(uint64) == uint64(math.MaxUint64) { | ||
return 0 | ||
} |
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 key point is to prevent the MinSafeTS
from not being updated permanently because of MaxUint64
. We should handle it from the updater rather than just the getter.
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 core question is the getter
- we introduce
PD API
to not executego func which for KV request
, resulting in not updatingsafeTSMap
.updateMinSafeTS
relies onsafeTSMap
which makes sense(because actually, we can callupdateMinSafeTS
tokvReuqestUpdater
[to indicate func base]).
- And we need to update
minsafeTS
to make sure when API fails we can fall back to the original way which is by kv request. - But the core problem is:
updateMinSafeTS
will returnmaxUnit64
when the first kv request returns 0[maybe kv is not initialized] and then althoughPD API
returns correctly, TS can not changemaxUnit64
.- to resolve this question, we need to regard
maxUnit64
as 0 which means there is an initial state.
- to resolve this question, we need to regard
Signed-off-by: husharp <[email protected]>
@nolouch PTAL as well, thx! |
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
Signed-off-by: husharp <[email protected]>
Signed-off-by: husharp <[email protected]>
b3be48b
to
3d9c8b0
Compare
Co-authored-by: cfzjywxk <[email protected]> Co-authored-by: cfzjywxk <[email protected]> Co-authored-by: disksing <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: zzm <[email protected]> Co-authored-by: husharp <[email protected]> Co-authored-by: you06 <[email protected]> Co-authored-by: buffer <[email protected]> Co-authored-by: 3pointer <[email protected]> Co-authored-by: buffer <[email protected]> Co-authored-by: husharp <[email protected]> Co-authored-by: crazycs520 <[email protected]> Co-authored-by: Smilencer <[email protected]> Co-authored-by: ShuNing <[email protected]> Co-authored-by: zyguan <[email protected]> Co-authored-by: Jack Yu <[email protected]> Co-authored-by: Weizhen Wang <[email protected]> Co-authored-by: lucasliang <[email protected]> Co-authored-by: healthwaite <[email protected]> Co-authored-by: xufei <[email protected]> Co-authored-by: JmPotato <[email protected]> Co-authored-by: ekexium <[email protected]> Co-authored-by: 山岚 <[email protected]> Co-authored-by: glorv <[email protected]> Co-authored-by: Yongbo Jiang <[email protected]> resolve locks interface for tidb gc_worker (#945) fix some issues of replica selector (#910) (#942) fix some issues of replica selector (#910) fix issue of configure kv timeout not work when disable batch client (#980) fix batch-client wait too long and add some metrics (#973) fix batch-client wait too long and add some metrics (#973)" (#984) fix data race at the aggressiveLockingDirty (#913) fix MinSafeTS might be set to MaxUint64 permanently (#994) fix: fix invalid nil pointer when trying to record Store.SlownessStat. (#1017) Fix batch client batchSendLoop panic (#1021) fix request source tag unset (#1025) Fix comment of `SuspendTime` (#1057)
close #991
The core question is the getter
PD API
to not executego func which for KV request
, resulting in not updatingsafeTSMap
.updateMinSafeTS
relies onsafeTSMap
which makes sense(because actually, we can callupdateMinSafeTS
tokvReuqestUpdater
[to indicate func base]).minsafeTS
to make sure when API fails we can fall back to the original way which is by kv request.updateMinSafeTS
will returnmaxUnit64
when the first kv request returns 0 and then althoughPD API
returns correctly[maybe kv is not initialized], TS can not changemaxUnit64
.maxUnit64
as 0 which means there is an initial state.