-
Notifications
You must be signed in to change notification settings - Fork 220
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
only set MinSafeTS to 0 when all stores' are 0 #1284
Conversation
Signed-off-by: zyguan <[email protected]>
minSafeTS = safeTS | ||
} | ||
} else { | ||
minSafeTS = 0 | ||
} | ||
} | ||
// if minSafeTS is still math.MaxUint64, that means all store safe ts are 0, then we set minSafeTS to 0. | ||
if minSafeTS == math.MaxUint64 { | ||
minSafeTS = 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.
Or could we set it to something like safepoint
ts ?
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.
Sound reasonable, let me think about if it would break some constraints.
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 seem minSafeTS=0
and minSafeTS=safepoint
are somehow equivalent here. The minSafeTS is exported by KVStore.GetMinSafeTS
and used for reading history data (stale read & flashback in tidb). safepoint <= read ts < min safe ts
is required for this usage. So:
- if we set min safe ts to 0 constantly,
read ts < min safe ts
cannot be satisfied, which should lead to errors like 'invalid read ts' or 'wait timeout'. - if we set min safe ts to safepoint,
safepoint <= read ts < min safe ts
are also always false, then the read should be forbidden as well.
IMO, it's ok to set it to 0, since setting it to safepoint doesn't make any difference.
Signed-off-by: zyguan <[email protected]>
#1277 introduce a regression: there might be a store whose safe ts is 0 for a long time, in this case, flashback will be blocked (ref: tikv/tikv#13675). We should
setMinSafeTS(0)
only when all (NOT any) ofstore.safe_ts = 0
.