-
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
br: migrate pitr id map to the system table mysql.tidb_pitr_id_map
#55871
Conversation
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Hi @Leavrth. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #55871 +/- ##
=================================================
- Coverage 72.9007% 56.8682% -16.0326%
=================================================
Files 1604 1756 +152
Lines 446805 630412 +183607
=================================================
+ Hits 325724 358504 +32780
- Misses 101028 247249 +146221
- Partials 20053 24659 +4606
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
kv.WithInternalSourceType(ctx, kv.InternalTxnBR), | ||
nil, | ||
getPitrIDMapSQL, | ||
restoreTS, |
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.
restoreTS
maybe confusing, because sometimes we use start-ts
to build pitr map. esspecially in L584.
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 current log restore's start-ts
is the last log restore's restored-ts
, so BR gets the pitr id map at start-ts
of the current log restore is actually to get the pitr id map at restored-ts
of the last log restore.
if err != nil { | ||
return errors.Trace(err) | ||
} | ||
// clean the dirty id map at first |
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.
is it safe? if process exits abnormally after deleting finished.
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.
We have the processes to persist id map:
- directly get the pitr id map if checkpoint task progress mark that BR has persist pitr id map.
- if not, generate pitr id map, and
a. delete the id map at restored ts
b. write the id map at restored ts
c. update the checkpoint task progress to mark that BR has persist pitr id map.
In the external storage, step 2.a and 2.b is replaced with uploading files with override mode. Actually, the atomic is not necessary. That's because there must be failed at the step 2.b or 2.c, which means the pitr id map is incomplete. But just do the step 2.a in the next execution to delete the incomplete pitr id map.
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.
Based on id map at start-ts
and the metakv to generate the new id map at restored-ts
. So delete the new id map at restored-ts
is safe because we still can regenerate the same one.
if BRVersion.Major > 8 || (BRVersion.Major == 8 && BRVersion.Minor >= 4) { | ||
if tikvVersion.Major < 8 || (tikvVersion.Major == 8 && tikvVersion.Minor < 4) { | ||
return errors.Annotatef(berrors.ErrVersionMismatch, | ||
"TiKV node %s version %s is too old because the PITR id map is written into the cluster system table mysql.tidb_pitr_id_map, please use the tikv with version v8.4.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.
I guess TiKV isn't related to the systable...? Perhaps replace "TiKV" with "cluster".
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.
Yes, there seems an assumption that each component version is the same.
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
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 for the bootstrap.
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
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.
/approve
for import part
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
/ok-to-test |
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
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
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, hawkingrei, lance6716, windtalker, winoros, yudongusa, YuJuncen The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: ref #55870
Problem Summary:
BR restore should not have the permission to write/delete the external storage.
What changed and how does it work?
migrate pitr id map to the system table
mysql.tidb_pitr_id_map
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.