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

ddl: get key ranges for flashback cluser ddl job #37542

Merged
merged 10 commits into from Sep 2, 2022

Conversation

Defined2014
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #37540

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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.

Get key ranges for `flashback cluser` ddl job

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 1, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • xhebox
  • zimulala

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note do-not-merge/needs-triage-completed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 1, 2022
@Defined2014
Copy link
Contributor Author

/run-check-issue-triage-complete

@Defined2014 Defined2014 changed the title ddl: support get flashback cluster kv ranges ddl: get key ranges for flashback cluser ddl job Sep 1, 2022
ddl/cluster.go Show resolved Hide resolved
ddl/cluster.go Outdated
if !table.IsBaseTable() || table.ID > meta.MaxGlobalID {
continue
}
nonFlashbackPhysicalIDs, allPhysicalIDs = addToSlice(db.Name.L, table.Name.L, table.ID, nonFlashbackPhysicalIDs, allPhysicalIDs)
Copy link
Member

Choose a reason for hiding this comment

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

if table.Partition != nil

For partitioned tables, (at least for now) we don't need to explicitly add its table id to physical IDs since there's no data prefixed with it.

However, this might not be the case in the future(for example, the 'global index' for partitioned tables(/cc @tiancaiamao and @mjonss ). So it might be a good idea to keep it as now.

ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
ddl/ddl_api.go Outdated Show resolved Hide resolved
@@ -156,44 +237,55 @@ func (w *worker) onFlashbackCluster(d *ddlCtx, t *meta.Meta, job *model.Job) (ve
return ver, err
}

// stage 1, check and set FlashbackClusterJobID.
// Stage 1, check and set FlashbackClusterJobID, and save the PD schedule.
if flashbackJobID == 0 {
err = kv.RunInNewTxn(w.ctx, w.store, true, func(ctx context.Context, txn kv.Transaction) error {
return meta.NewMeta(txn).SetFlashbackClusterJobID(job.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a kv key? Could we a variable like GC? At present, some kv are replaced with variables, so if it is not necessary, introduce this kind of kv as little as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, maybe I can change it to global variables in next PR

ddl/cluster.go Outdated Show resolved Hide resolved
ddl/cluster.go Show resolved Hide resolved
ddl/cluster.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 2, 2022
Copy link
Contributor

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

Approve by mistake..

@ti-chi-bot ti-chi-bot removed the status/LGT1 Indicates that a PR has LGTM 1. label Sep 2, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 2, 2022
ddl/cluster.go Outdated Show resolved Hide resolved
Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 2, 2022
@Defined2014
Copy link
Contributor Author

/merge

3 similar comments
@Defined2014
Copy link
Contributor Author

/merge

@hawkingrei
Copy link
Member

/merge

@Defined2014
Copy link
Contributor Author

/merge

@Defined2014 Defined2014 added the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2022
@Defined2014
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1957

@hawkingrei
Copy link
Member

/check-issue-triage-complete

@Defined2014
Copy link
Contributor Author

/merge

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2022
@ti-chi-bot
Copy link
Member

@Defined2014: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@Defined2014
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: b61fd89

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 2, 2022
@Defined2014
Copy link
Contributor Author

/run-mysql-test tidb-test=pr/1957

@ti-chi-bot ti-chi-bot merged commit db6c741 into pingcap:master Sep 2, 2022
@Defined2014 Defined2014 deleted the flashback-kvranges branch November 23, 2022 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flashback cluster gets key ranges
6 participants