-
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: copy full backup to pitr storage #57716
Conversation
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Hi @YuJuncen. 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: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
Signed-off-by: hillium <yujuncen@pingcap.com>
/retest |
@BornChanger: 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. |
@@ -0,0 +1,487 @@ | |||
package snapclient |
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.
missing license header?
@@ -0,0 +1,261 @@ | |||
package snapclient |
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.
missing license header?
Signed-off-by: hillium <yu745514916@live.com>
[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:
|
@YuJuncen: The following test 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. |
Signed-off-by: hillium <yu745514916@live.com>
/retest |
@BornChanger: 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. |
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 overall, just a bunch of nit comments
pkg/metrics/br.go
Outdated
Subsystem: "br", | ||
Name: "restore_import_file_seconds", | ||
|
||
Help: "The time cost for importing a file. (including the time costed in queuing)", |
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.
typo: cost
is same for present and past tense.
collector.SetSuccessStatus(success) | ||
} | ||
|
||
// Succeed returns whether the last call to `SetSuccessStatus` passes `true`. | ||
func Succeed() bool { |
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.
typo? success
br/pkg/errors/errors.go
Outdated
@@ -40,6 +40,7 @@ var ( | |||
ErrEnvNotSpecified = errors.Normalize("environment variable not found", errors.RFCCodeText("BR:Common:ErrEnvNotSpecified")) | |||
ErrUnsupportedOperation = errors.Normalize("the operation is not supported", errors.RFCCodeText("BR:Common:ErrUnsupportedOperation")) | |||
ErrInvalidRange = errors.Normalize("invalid restore range", errors.RFCCodeText("BR:Common:ErrInvalidRange")) | |||
ErrMigrationNotFound = errors.Normalize("no migrtion found", errors.RFCCodeText("BR:Common:ErrMigrationNotFound")) |
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.
typo migrtion
in error message
br/pkg/glue/glue.go
Outdated
@@ -82,3 +83,22 @@ type Progress interface { | |||
// called. | |||
Close() | |||
} | |||
|
|||
type CounterProgress 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.
looks like this is only used in test, should we move it to the test file instead?
@@ -55,6 +55,10 @@ type Glue struct { | |||
startDomainMu *sync.Mutex | |||
} | |||
|
|||
func WrapSession(se sessiontypes.Session) glue.Session { |
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.
also only used in test, should we move it?
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 cannot move this to test file because this function uses the private structure tidbSession
. This function is somehow a public constructor of tidbSession
.
@@ -98,6 +98,10 @@ func InitMetrics() { | |||
InitInfoSchemaV2Metrics() | |||
timermetrics.InitTimerMetrics() | |||
|
|||
// For now, those metrics are initialized but not registered. |
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's a bit weird to print metrics instead of integrating it into the existing dashboard, is it because br cannot publish stats to prometheus?
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, perhaps we need a Push Gateway... Raw Prometheus isn't pretty friendly to batch operations...
const JitterMs = 5000 | ||
|
||
retry := utils.InitialRetryState(math.MaxInt, 1*time.Second, 60*time.Second) | ||
jitter := time.Duration(rand.Uint32()%JitterMs+(JitterMs/2)) * time.Millisecond |
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 jitter is a bit weird, looks like it's always going to be above 2500? I guess why don't we set jitter to be 2500 and just do rand.Uint32()%JitterMs
also can move this to a method in the retry module, feels like going to be needed in many case so don't need to rewrite the jitter calculation every time
@@ -242,3 +252,18 @@ func (wm *WithMigrations) Compactions(ctx context.Context, s storage.ExternalSto | |||
return Subcompactions(ctx, name, s) | |||
}) | |||
} | |||
|
|||
func (wm *WithMigrations) IngestedSSTs(ctx context.Context, s storage.ExternalStorage) iter.TryNextor[*backuppb.IngestedSSTs] { |
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.
one question, IDE has warning about the style
Struct WithMigrations has methods on both value and pointer receivers. Such usage is not recommended by the Go Documentation.
and for many other structs as well. I'm wondering if we are doing impl for both on purpose or by accident?
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.
Most of times are by accident. A typical scenario is that a structure was treated as value type (which has only value receivers) at the beginning, but with developing, we have noticed that sometimes it need to be a reference type (say, needing mutate its content by a method), then a method with pointer was added.
} | ||
} | ||
|
||
type pitrCollector 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.
can add some comment to this struct since its logic is important to the whole feature.
br/pkg/restore/log_client/ssts.go
Outdated
s.SstOutputs = files | ||
} | ||
|
||
type AddedSSTs 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.
maybe add some comment to this struct.
also from the logic looks like it represents one sst? can we drop the s
in the name as it's suggesting the other way
Signed-off-by: hillium <yu745514916@live.com>
/hold |
Signed-off-by: hillium <yu745514916@live.com>
/unhold |
Signed-off-by: hillium <yu745514916@live.com>
What problem does this PR solve?
Issue Number: close #58685
Problem Summary:
Now, a log backup task cannot back full restorations happen in the cluster up.
What changed and how does it work?
This PR makes BR upload the SSTs it imported to the log backup storage.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.