Skip to content
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: clean codes -- restore tables #55519

Merged
merged 8 commits into from
Aug 26, 2024

Conversation

Leavrth
Copy link
Contributor

@Leavrth Leavrth commented Aug 20, 2024

What problem does this PR solve?

Issue Number: ref #52877

Problem Summary:
we can clean some codes

What changed and how does it work?

simplify the split & scatter and download & ingest stages

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Aug 20, 2024
Copy link

tiprow bot commented Aug 20, 2024

Hi @Leavrth. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 74.45652% with 94 lines in your changes missing coverage. Please review.

Project coverage is 75.7049%. Comparing base (c1c74b1) to head (54d72eb).
Report is 37 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55519        +/-   ##
================================================
+ Coverage   72.8739%   75.7049%   +2.8310%     
================================================
  Files          1576       1585         +9     
  Lines        440775     454817     +14042     
================================================
+ Hits         321210     344319     +23109     
+ Misses        99821      89552     -10269     
- Partials      19744      20946      +1202     
Flag Coverage Δ
integration 50.4126% <64.1304%> (?)
unit 71.8581% <30.9782%> (-1.0150%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 62.2083% <74.4565%> (+16.2624%) ⬆️

Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
@@ -85,8 +84,67 @@ func (rg *Range) Less(than btree.Item) bool {
return bytes.Compare(rg.StartKey, ta.StartKey) < 0
}

var _ btree.Item = &RangeStats{}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range for backup, RangeStats for restore to be merged

defer updateCh.Close()
sender, err := snapclient.NewTiKVSender(ctx, client, updateCh, cfg.PDConcurrency)
placementRuleManager, err := snapclient.NewPlacementRuleManager(ctx, mgr.GetPDClient(), mgr.GetPDHTTPClient(), mgr.GetTLSConfig(), cfg.Online)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many functions that set something before split&scatter and download&ingest and reset after that. We can unify them into one context manager.

@@ -324,133 +114,29 @@ func (b *Batcher) filterOutRanges(checkpointSet map[string]struct{}, drained []r
// |--|-------|
// |t2|t3 |
// as you can see, all restored ranges would be removed.
func (b *Batcher) drainRanges() DrainResult {
func drainRanges(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be removed by the next PR

Signed-off-by: Jianjun Liao <[email protected]>
@Leavrth
Copy link
Contributor Author

Leavrth commented Aug 23, 2024

/retest

Copy link

tiprow bot commented Aug 23, 2024

@Leavrth: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Copy link
Contributor

@YuJuncen YuJuncen left a 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/rtree/rtree.go Outdated Show resolved Hide resolved
br/pkg/rtree/rtree.go Outdated Show resolved Hide resolved
br/pkg/task/restore_raw.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 23, 2024
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
@Leavrth
Copy link
Contributor Author

Leavrth commented Aug 26, 2024

/retest

Copy link

tiprow bot commented Aug 26, 2024

@Leavrth: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@@ -1,81 +0,0 @@
#!/bin/sh
Copy link
Contributor

@3pointer 3pointer Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is used for small tables scenario test. Shall we keep it?

@@ -48,6 +51,14 @@ func MergeAndRewriteFileRanges(
for _, file := range files {
filesMap[string(file.StartKey)] = append(filesMap[string(file.StartKey)], file)

// Assert that it has the same end key.
if !bytes.Equal(filesMap[string(file.StartKey)][0].EndKey, file.EndKey) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need this check? for some scenarios like compacted ssts may not satisfied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To assert range's start-key and end-key is the same as that of any file of the range.

// RangeStats represents a restore merge result.
type RangeStats struct {
Range
Size uint64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size and Count seems never used...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used in the next PR

Copy link

ti-chi-bot bot commented Aug 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3pointer, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 26, 2024
Copy link

ti-chi-bot bot commented Aug 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-23 08:24:18.440102219 +0000 UTC m=+513053.574552340: ☑️ agreed by YuJuncen.
  • 2024-08-26 05:41:56.407561151 +0000 UTC m=+762511.542011272: ☑️ agreed by 3pointer.

@Leavrth
Copy link
Contributor Author

Leavrth commented Aug 26, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Aug 26, 2024
@ti-chi-bot ti-chi-bot bot merged commit 4eeeef8 into pingcap:master Aug 26, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants