Skip to content
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

Merged
merged 3 commits into from
Apr 18, 2024
Merged

Conversation

zyguan
Copy link
Contributor

@zyguan zyguan commented Apr 10, 2024

#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) of store.safe_ts = 0.

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor Author

@zyguan zyguan Apr 10, 2024

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.

@cfzjywxk cfzjywxk merged commit 713ceee into tikv:master Apr 18, 2024
10 checks passed
@zyguan zyguan mentioned this pull request Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants