-
Notifications
You must be signed in to change notification settings - Fork 6k
br: record files into filesOfPhysicalID #60423
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
Conversation
Signed-off-by: Jianjun Liao <[email protected]>
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. |
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #60423 +/- ##
================================================
+ Coverage 73.1369% 74.9570% +1.8200%
================================================
Files 1716 1762 +46
Lines 475676 483968 +8292
================================================
+ Hits 347895 362768 +14873
+ Misses 106410 98491 -7919
- Partials 21371 22709 +1338
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
} | ||
|
||
// GetPartitionByName gets the partition ID from the given tableInfo if its name matches | ||
func GetPartitionByName(tableInfo *model.TableInfo, name ast.CIStr) (int64, error) { |
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 there no exiting method to get partition by name?
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. Replace it by (*Partition).GetPartitionIDByName and reserve the function to convert the returned result -1
to error.
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.
other part lgtm
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
if err != nil { | ||
return errors.Trace(err) | ||
} | ||
if backupMeta.IsRawKv || backupMeta.IsTxnKv { |
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 make a case (ut or integration) to cover the logic branch.
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
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.
rest LGTM
|
||
codec := mgr.GetStorage().GetCodec() | ||
if len(files) == 0 { | ||
anyFileKey := getAnyFileKeyFromTables(tables) |
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.
will file.StartKey be nil?
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.
done, getAnyFileKeyFromTables
will return a non-nil key.
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
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!
if fileMap != nil { | ||
if files, ok := fileMap[table.Info.ID]; ok { | ||
table.Files = append(table.Files, files...) | ||
if files, ok := fileMap[table.Info.ID]; ok && len(files) > 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 on line 443 it's not tableID but physcialID?
fileMap[tableID] = append(fileMap[tableID], file)
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
return errors.Trace(err) | ||
} | ||
if statsErr = statsHandler.SaveMetaToStorage(newDefID, count, 0, "br restore", false); statsErr != nil { | ||
log.Error("update stats meta failed", zap.Any("table", tbl.Table), zap.Int64("downstream partition id", newDefID), zap.Error(statsErr)) |
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.
would log entire table be too much details? I'm concerned of log spamming
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.
done
if tableInfo.Partition == nil { | ||
return 0, errors.Errorf("the table %s[id=%d] does not have parition", tableInfo.Name.O, tableInfo.ID) | ||
} | ||
if partID := tableInfo.Partition.GetPartitionIDByName(name.L); partID > 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.
could this name be empty string? Jus asking
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.
No
Signed-off-by: Jianjun Liao <[email protected]>
/retest |
@Leavrth: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, BornChanger 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 |
[LGTM Timeline notifier]Timeline:
|
/ok-to-test |
/retest |
1 similar comment
/retest |
What problem does this PR solve?
Issue Number: ref #60374
Problem Summary:
BR needs to update the stats meta of the partition.
What changed and how does it work?
Record files based on the physical ID.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.