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

compacted restore: ignore some keys out of specific range #59112

Merged
merged 15 commits into from
Jan 24, 2025

Conversation

3pointer
Copy link
Contributor

@3pointer 3pointer commented Jan 22, 2025

What problem does this PR solve?

Issue Number: close #58238

Problem Summary:
Add time range filter for compacted sst files to reduce the download traffic during restore.

What changed and how does it work?

use shiftStartTs for default cf to filter sst data.
use startTs for write cf to filter sst data.
use restoredTs for both default and write cf.

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

Copy link

ti-chi-bot bot commented Jan 22, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 22, 2025
Copy link

tiprow bot commented Jan 22, 2025

Hi @3pointer. 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.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-tests-checked labels Jan 22, 2025
@3pointer 3pointer marked this pull request as ready for review January 22, 2025 09:08
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 22, 2025
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

})
}

return &RewriteRules{Data: dataRules, NewTableID: newTableID, TableIDRemapHint: remaps}
return &RewriteRules{Data: dataRules, NewTableID: newTableID, ShiftStartTs: shiftStartTs, StartTs: startTs, RestoredTs: restoredTs, TableIDRemapHint: remaps}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the caller may manually fill the ShiftStartTs stuffs after getting the returned RewriteRules. So I think perhaps we don't need to add two new arguments to the function (anyway this requires us to modify all call sites...).

@@ -245,11 +245,11 @@ func (wm *WithMigrations) Metas(metaNameIter MetaNameIter) MetaMigrationsIter {
})
}

func (wm *WithMigrations) Compactions(ctx context.Context, s storage.ExternalStorage) iter.TryNextor[*backuppb.LogFileSubcompaction] {
func (wm *WithMigrations) Compactions(ctx context.Context, s storage.ExternalStorage, shiftStartTS, restoreTS uint64) iter.TryNextor[*backuppb.LogFileSubcompaction] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to add shiftStartTS to the WithMigrations? I think in this context we may usually require this TS. Also it seems WithMigrations has a field of restored ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already have, fixed.

@@ -1914,7 +1914,7 @@ func parseFullBackupTablesStorage(
}, nil
}

func initRewriteRules(schemasReplace *stream.SchemasReplace) map[int64]*restoreutils.RewriteRules {
Copy link
Contributor

Choose a reason for hiding this comment

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

Say... We may register the shiftedStartTs, startTs and restoredTs to each rewrite rules in the returned map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we don't have such common rule for rewrite, it's bind with table.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 22, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 61.81818% with 21 lines in your changes missing coverage. Please review.

Project coverage is 75.4203%. Comparing base (51d723b) to head (903bfe7).
Report is 25 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59112        +/-   ##
================================================
+ Coverage   73.0289%   75.4203%   +2.3914%     
================================================
  Files          1683       1705        +22     
  Lines        466114     480463     +14349     
================================================
+ Hits         340398     362367     +21969     
+ Misses       104792      95870      -8922     
- Partials      20924      22226      +1302     
Flag Coverage Δ
integration 47.1168% <23.6363%> (?)
unit 73.2905% <54.5454%> (+1.0640%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 60.2243% <61.8181%> (+14.8836%) ⬆️

Copy link

ti-chi-bot bot commented Jan 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Leavrth, 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 Jan 23, 2025
Copy link

ti-chi-bot bot commented Jan 23, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-22 09:21:10.847616684 +0000 UTC m=+258998.178536083: ☑️ agreed by YuJuncen.
  • 2025-01-23 08:03:14.063137714 +0000 UTC m=+340721.394057118: ☑️ agreed by Leavrth.

@BornChanger
Copy link
Contributor

/retest

Copy link

tiprow bot commented Jan 24, 2025

@BornChanger: 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.

@ti-chi-bot ti-chi-bot bot merged commit f5dc850 into pingcap:master Jan 24, 2025
23 checks passed
hawkingrei pushed a commit to hawkingrei/tidb that referenced this pull request Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sure the br filter the restore compacted data correctly
4 participants