-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: add table filter for log restore #57394
base: master
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
Hi @Tristan1900. 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. |
7c04493
to
8ef978b
Compare
8ef978b
to
02a2318
Compare
02a2318
to
c29b578
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #57394 +/- ##
================================================
+ Coverage 73.0858% 74.1448% +1.0590%
================================================
Files 1676 1695 +19
Lines 463685 464167 +482
================================================
+ Hits 338888 344156 +5268
+ Misses 103941 98406 -5535
- Partials 20856 21605 +749
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f624281
to
6ebc531
Compare
852dcff
to
b5132a9
Compare
d2b68b8
to
d72415c
Compare
04d4ccf
to
f0eb49d
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
2f06bd9
to
924a195
Compare
br/pkg/stream/table_mapping.go
Outdated
} else { | ||
dr.Name = dbInfo.Name.O | ||
} | ||
return nil | ||
} | ||
|
||
func (tc *TableMappingManager) parseTableValueAndUpdateIdMapping(dbID int64, value []byte) error { | ||
func (tm *TableMappingManager) ProcessTableValueAndUpdateIdMapping(dbID int64, tableInfo model.TableInfo) 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.
Why not pass by pointer, which is like tableInfo *model.TableInfo
?
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.
And remove tableInfo.ID = tableReplace.TableID
and partitions.Definitions[i].ID = newID
below.
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.
good call, these are from the rewrite method, not needed here
ee5d347
to
45bcdca
Compare
} | ||
|
||
// collect table history indexed by table id, same id may have different table names in history | ||
if meta.IsTableKey(rawKey.Field) { |
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.
else if meta.IsTableKey(rawKey.Field) {
br/pkg/stream/table_mapping.go
Outdated
} else { | ||
dr.Name = dbInfo.Name.O | ||
} | ||
return nil | ||
} | ||
|
||
func (tc *TableMappingManager) parseTableValueAndUpdateIdMapping(dbID int64, value []byte) error { | ||
func (tm *TableMappingManager) ProcessTableValueAndUpdateIdMapping(dbID int64, tableInfo model.TableInfo) 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.
And remove tableInfo.ID = tableReplace.TableID
and partitions.Definitions[i].ID = newID
below.
// check during log backup | ||
dbName = name | ||
} else { | ||
log.Warn("did not find db id in full/log backup, "+ |
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.
perhaps it's better to return an error because it must be a code-level 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.
if we have full backup with --filter="foo*" and PiTR doesn't have any filter, it can have this problem, let me know your thoughts on how to better handle this situation
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
br/pkg/task/restore.go
Outdated
return | ||
} | ||
|
||
func adjustTablesToRestoreAndCreateTableTracker( |
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 function is important so it needs some unit tests.
tempIDs = append(tempIDs, id) | ||
} | ||
|
||
// sort to -1, -2, -4, -8 ... etc |
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.
tempIDs[i] > tempIDs[j]
does not means upstream(tempIDs[i]) > upstream[tempIDs[j])
, so is it necessary to sort tempIDs?
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 it doesn't, I was thinking to assign id based on first seen first, somewhat like sorted by time in the log backup, I was hoping it can be a bit useful when debugging. The order doesn't suggest anything such as upstream id ordering.
} | ||
|
||
// need to restore the matching table in snapshot restore phase | ||
for _, originalTable := range originalDB.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.
I prefer to merge filterRestoreFiles
and adjustTablesToRestoreAndCreateTableTracker
without any intermediates. That's because I am worried about the time complexity of the loop.
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
4788a14
to
9bf682b
Compare
Signed-off-by: Wenqi Mou <[email protected]>
Signed-off-by: Wenqi Mou <[email protected]>
@Tristan1900: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #57613
Problem Summary:
Need table filter for PiTR
What changed and how does it work?
The following happens if a custom filter is specified during PiTR.
Performance:
we are still scanning log meta kv twice, it's just we move the previously id map building step before snapshot happens.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.