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/storage: adapt copier for azure and gcs #59328

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

YuJuncen
Copy link
Contributor

@YuJuncen YuJuncen commented Feb 7, 2025

What problem does this PR solve?

Issue Number: close #(TBD)

Problem Summary:

When log backup enabled, restoring from azure blob storage and GCS is still impossible because they didn't implement Copier.

What changed and how does it work?

This Added support to CopyFrom for AzureBlobStorage and GCSStorage.

Check List

Tests

  • Unit test
    Tested Azure by azurite.
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Start PiTR by:
#! /usr/bin/env fish

set pfx $fish_pid
set -q container || set container "tc-tidb-0"
set -q strg_prefix || set strg_prefix "test"

function strg
	echo "gs://br-datasets/$argv[1]"
end


function br
	kubectl exec '-it' $container '--' /br-for-restore $argv
end

br backup full -s (strg "juncen/tpcc-test/$pfx/$strg_prefix-full") $argv
gcloud storage cp (strg "juncen/tpcc-test/$pfx/$strg_prefix-full/backupmeta") ./.backupmeta.tmp
set backupts (cat ./.backupmeta.tmp | _get_brpb BackupMeta | rg -r '$1' 'end_version: (\d+)$')
br log start -s (strg "juncen/tpcc-test/$pfx/$strg_prefix-incr") --task-name fiolvit $argv --start-ts "$backupts"
br log status $argv

Restore a backup by:

/br-for-restore restore full -s 'gcs://br-datasets/juncen/tpcc-40' --checksum=false -u tc-pd:2379 --gcs.credentials-file /gcloud-cred.json

Then restore with:

/br-for-restore restore point -s 'gs://br-datasets/juncen/tpcc-test/3078828/test-incr' --checksum=false -u tc-pd:2379 --gcs.credentials-file /gcloud-cred.json --full-backup-storage 'gs://br-datasets/juncen/tpcc-test/3078828/test-full' 

Check the restored data:

TiDB root@tc-tidb:test> select count(*) from history;
+----------+
| count(*) |
+----------+
| 1200000  |
+----------+
  • 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-linked-issue 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. labels Feb 7, 2025
Copy link

ti-chi-bot bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from yujuncen, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

tiprow bot commented Feb 7, 2025

Hi @YuJuncen. 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 Feb 7, 2025

Codecov Report

Attention: Patch coverage is 3.57143% with 54 lines in your changes missing coverage. Please review.

Project coverage is 74.7431%. Comparing base (9c37399) to head (864e125).
Report is 53 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59328        +/-   ##
================================================
+ Coverage   73.0489%   74.7431%   +1.6942%     
================================================
  Files          1684       1736        +52     
  Lines        466386     490085     +23699     
================================================
+ Hits         340690     366305     +25615     
+ Misses       104751     100710      -4041     
- Partials      20945      23070      +2125     
Flag Coverage Δ
integration 48.6267% <0.0000%> (?)
unit 72.2681% <3.5714%> (+0.0263%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 59.5919% <3.5714%> (+14.2687%) ⬆️

Signed-off-by: hillium <[email protected]>
}
dstBlob := s.containerClient.NewBlobClient(s.withPrefix(spec.To))

// NOTE: `CopyFromURL` supports files up to 256 MiB, which might not be enough for huger regions?
Copy link
Contributor

Choose a reason for hiding this comment

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

a good catch. if the error code returned does not contain the detailed reason, we have to document the restriction in release notes.

srcName := es.objectName(spec.From)
// A note here:
// https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite
// It seems extra configuration is needed when doing cross-region copying.
Copy link
Contributor

Choose a reason for hiding this comment

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

we also need to document the special requirements.

Copy link

ti-chi-bot bot commented Feb 8, 2025

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/needs-linked-issue 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.

2 participants