Skip to content

Conversation

@YuJuncen
Copy link
Contributor

This is an automated cherry-pick of #64982

What problem does this PR solve?

Issue Number: close #64833

Problem Summary:
See the issue.

What changed and how does it work?

Added a filter to loader, which allows the caller to load a subset of tables only.

This pick is finished by codex.

__agent_task.md # Background

We just merged 9c0773b008bd015842689b5fc31d91ab9842801f to master. But, (how sadly!) it seems in master branch there is a refactor over DDL has been performed, the folder structure of DDL subsystem is fully different with master. . We cannot trivially use git cherry-pick to pick it back to release-8.5.

However, me, a bad-luck engineer. Have been required to pick it back to release-8.5. I need your help.

Would you finish this cherry-pick for me with the following steps? Also don't forget to fill the document during working.

Workflow

  1. Firstly, check the commit by git show 9c0773b008bd015842689b5fc31d91ab9842801f and the folder structure. Determine patches that can be trivially applied. Apply them then commit them. You don't need to pick patches of go.{mod,sum} or *.{bzl,bazel}.

Describe parts you have applied here:

  • Added br/pkg/utils/schema.go:UnquoteName (used by restore schema filtering).
  • Updated br/tests/br_tidb_placement_policy/run.sh to export BR_LOG_TO_TERM=1 before restore, matching upstream.
  • Added meta.Reader.IterDatabases + meta.Mutator.IterDatabases (and a unit test) to allow iterating DB infos without materializing the full list.
  • Introduced pkg/meta/metadef/db.go with helpers to identify system/memory/BR-temporary DBs, matching upstream definitions.

Commit it (but don't commit this file), let's continue.

  1. Manually "apply" the refactored part in DDL. You may need to find code snippets in the commit, apply them to right position.

Describe what you did here:

  • Added a lightweight infoschema schema-filter mechanism for BR:
    • Introduced pkg/infoschema/issyncer.Filter (ported from upstream) and br/pkg/gluetidb.NewInfoSchemaFilter.
    • Extended pkg/session domain creation to accept a filter (GetOrCreateDomainWithFilter), passing it into pkg/domain.NewDomain.
    • Threaded the filter into pkg/domain/domain.go schema loading:
      • full load: iterate DBs via meta.Reader.IterDatabases and only load selected schemas;
      • diff load: skip irrelevant schema diffs and still advance schema version via infoschema.Builder.SetSchemaVersion.
    • Updated BR CLI to set the filter before running:
      • backup: load only system/BR-temp DBs;
      • restore with explicit schema selection: load selected DBs + system/BR-temp DBs.

Commit it, let's continue.

  1. Fix any build error. Criteria: make server, make build_br and make lint all returns zero.

Commit it (if any), let's continue.

  1. Use git range-diff to generate a patch-of-patch between your modification and the origin patch (9c0773b008bd015842689b5fc31d91ab9842801f).

Fill your git range-diff command here:

# git range-diff --no-color --creation-factor=90 9c0773b008bd015842689b5fc31d91ab9842801f^..9c0773b008bd015842689b5fc31d91ab9842801f 1fa258b833..HEAD

Save its output to __agent_output.txt.

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.

Optimizated DDL performance during backing up / restoring.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 23, 2026
@tiprow
Copy link

tiprow bot commented Jan 23, 2026

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.

Details

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
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 65.11628% with 45 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-8.5-20260116-v8.5.5@1fa258b). Learn more about missing BASE report.

Additional details and impacted files
@@                       Coverage Diff                        @@
##             release-8.5-20260116-v8.5.5     #65741   +/-   ##
================================================================
  Coverage                               ?   73.2373%           
================================================================
  Files                                  ?       1683           
  Lines                                  ?     469351           
  Branches                               ?          0           
================================================================
  Hits                                   ?     343740           
  Misses                                 ?     102737           
  Partials                               ?      22874           
Flag Coverage Δ
integration 50.9278% <60.4651%> (?)
unit 64.9295% <24.0310%> (?)

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

Components Coverage Δ
dumpling 52.8145% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 63.8541% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@D3Hunter D3Hunter 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

.PHONY: tools/bin/revive
tools/bin/revive:
GOBIN=$(shell pwd)/tools/bin $(GO) install github.com/mgechev/revive@v1.2.1
@test -x $@ || GOBIN=$(shell pwd)/tools/bin $(GO) install github.com/mgechev/revive@v1.2.1
Copy link
Contributor

Choose a reason for hiding this comment

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

why change it

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 23, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found here.

Details 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
Copy link

ti-chi-bot bot commented Jan 23, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-23 03:59:31.663979538 +0000 UTC m=+725599.277936384: ☑️ agreed by D3Hunter.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 23, 2026
@YuJuncen
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Jan 23, 2026

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

Details

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants