-
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
Restore: implement restorer for compacted SST/Snapshot/log files #57208
base: master
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
[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 |
Hi @3pointer. 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 #57208 +/- ##
================================================
+ Coverage 72.8367% 74.6477% +1.8110%
================================================
Files 1672 1721 +49
Lines 462640 471130 +8490
================================================
+ Hits 336972 351688 +14716
+ Misses 104878 97343 -7535
- Partials 20790 22099 +1309
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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
} | ||
if len(sstOutputs) != len(subCompaction.SstOutputs) { | ||
log.Info("partial files in sub compaction skipped due to checkpoint") | ||
subCompaction.SstOutputs = sstOutputs |
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 is a little strange that a predicate function modifies its argument. Would you add some comments in the interface?
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.
This is because the subCompaction
is not a basic restore unit during restore, the restore unit is file. and subCompaction
might contains multiple files. sometimes we may need to skip partial files in one subCompaction
.
// Skip the file by checkpoints or invalid files | ||
ShouldSkip(T) bool | ||
// GetAccumulations returns an iterator for the accumulated values. | ||
GetAccumulations() *SplitHelperIterator |
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 is a little strange that Accumulate
receives T
but GetAccumulations
returns Valued
? It seems this method actually returns the keys to be splitted.
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, I want to refactor SplitHelperIterator
too, but I suggest doing this in future PR.
Close() error | ||
} | ||
|
||
type FileImporter interface { |
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 seems FileImporter
is almost the same as SstRestorer
. Would you merge them or add some comments that explains why we need two?
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.
ok, add some comments, PTAL
onProgress(int64(len(filesReplica))) | ||
} | ||
}() | ||
if importErr := m.fileImporter.Import(m.ectx, filesReplica...); importErr != 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.
It seems we already managed the concurrenct execution. Why we still need ConcurrentlFileImporter
here? Would you replace it with a normal one or add some comment here to explain?
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.
ConcurrentFileImporter
only used in MultiTablesRestorer
, which has a condition wait during restore. this make a better control of concurrency to make download balanced.
If we make this a default behavior for raw/txn ssts. Then it can be removed. but in this PR, I want to make the behavior keeps same as before.
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'm wondering that given there is internal concurrency in the ConcurrentFileImporter
, is the outer workerPool
still needed?
return f[:idx] | ||
} | ||
|
||
type PipelineRestorerWrapper[T any] struct { |
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 this can be a plain function. So the type argument can be deduced, no explicit annotations like restore.PipelineRestorerWrapper[*logclient.LogDataFileInfo]
needed.
/test unit-test |
@3pointer: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
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/test-infra repository. |
/test pull-lightning-integration-test |
@3pointer: 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. |
@3pointer: 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. |
@3pointer: 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/test-infra repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #57209
Problem Summary:
This pull request introduces a unified structure for managing compacted SST, Snapshot, and log files. Previously, these file types were handled independently, leading to redundant code and potential inconsistencies. The new common struct simplifies file management, improves code maintainability, and reduces the likelihood of errors.
What changed and how does it work?
Impact: This update significantly streamlines the restoration process, reducing complexity and improving performance by adopting a unified handling approach. Components across the system have been updated to leverage the new struct, fostering consistency and reducing maintenance overhead.
NOTE: This PR doesn't consider the
checkpoint
logic for compacted log files. I'll do it in another PR.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.