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

rc: add resource group name to ddl #46756

Merged
merged 10 commits into from
Sep 12, 2023
Merged

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Sep 7, 2023

What problem does this PR solve?

Issue Number: ref #46656

Problem Summary:

What is changed and how it works?

as title

Check List

Tests

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

add index
image

  • 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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 7, 2023
@wuhuizuo
Copy link
Contributor

wuhuizuo commented Sep 7, 2023

/test ?

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 7, 2023

@wuhuizuo: The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-prisma-test
  • /test pull-mysql-connector-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test ?

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/test-infra repository.

@tiprow
Copy link

tiprow bot commented Sep 7, 2023

@wuhuizuo: The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test ?

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/test-infra repository.

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #46756 (d3ad2bf) into master (ae442ad) will decrease coverage by 0.1009%.
Report is 19 commits behind head on master.
The diff coverage is 93.3333%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46756        +/-   ##
================================================
- Coverage   73.3573%   73.2564%   -0.1009%     
================================================
  Files          1324       1349        +25     
  Lines        396657     406569      +9912     
================================================
+ Hits         290977     297838      +6861     
- Misses        87119      90266      +3147     
+ Partials      18561      18465        -96     
Flag Coverage Δ
integration 27.9922% <62.6666%> (?)
unit 73.8778% <93.3333%> (+0.5204%) ⬆️

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

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 85.4060% <ø> (+0.4451%) ⬆️
br 48.7919% <ø> (-3.8439%) ⬇️

if tagger := w.getResourceGroupTaggerForTopSQL(job.ID); tagger != nil {
txn.SetOption(kv.ResourceGroupTagger, tagger)
}
if job.ReorgMeta != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove this logical? It seems we do it in the funcion of
jobContext on the line767(https://github.com/pingcap/tidb/pull/46756/files#diff-a185df836b8926c4afe351d4def1b56d1e282c65aabe6677c2fa2c54590cc4b2R477)

ddl/ddl_worker.go Outdated Show resolved Hide resolved
@okJiang
Copy link
Member Author

okJiang commented Sep 11, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Sep 11, 2023
@@ -684,7 +684,7 @@ func (dc *ddlCtx) writePhysicalTableRecord(sessPool *sess.Pool, t table.Physical
}
})

jc := dc.jobContext(job.ID)
jc := dc.jobContext(job.ID, job.ReorgMeta)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use reorgInfo.NewJobContext() instead of this? In addition, how to determine whether to use 'reorgInfo.NewJobContext()' or 'dc.jobContext(job.ID, job.ReorgMeta)'

Copy link
Member Author

Choose a reason for hiding this comment

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

reorgInfo is a concept at the higher level of DDL job, in this function, we can only get DDL job. If we can get reorgInfo, we prefer to call NewJobContext first, because this function does not need to pass additional parameters. Otherwise, call jobContext().

Copy link
Contributor

Choose a reason for hiding this comment

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

But this function has the argument of reorgInfo *reorgInfo, so why not just use it?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in 390b696

@okJiang
Copy link
Member Author

okJiang commented Sep 11, 2023

/retest

ddl/ddl_api.go Outdated
Warnings: make(map[errors.ErrorID]*terror.Error),
WarningsCount: make(map[errors.ErrorID]int64),
Location: &model.TimeZoneLocation{Name: tzName, Offset: tzOffset},
ResourceGroupName: ctx.GetSessionVars().ResourceGroupName,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add it to MultiSchemaChange's ReorgMeta?

Copy link
Contributor

Choose a reason for hiding this comment

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

Besides, could we add a NewReorgMeta to unify the assignment? This helps reduce the possibility of missing parameter assignments later on

Copy link
Member Author

Choose a reason for hiding this comment

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

Besides, could we add a NewReorgMeta to unify the assignment? This helps reduce the possibility of missing parameter assignments later on

lgtm

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed all in d3ad2bf

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 bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 12, 2023
Copy link
Contributor

@glorv glorv left a comment

Choose a reason for hiding this comment

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

LGTM

} else {
ctx = NewJobContext()
}
if reorgMeta != nil && len(ctx.resourceGroupName) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if reorgMeta != nil && len(ctx.resourceGroupName) == 0 {
if reorgMeta != nil {

No need to check ctx's resource-group, it may be the default value default

Copy link
Member Author

Choose a reason for hiding this comment

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

Is default necessary? If it is, we need add a lock for it. Otherwise, it will occur data race.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any case that depend on the ctx.resourceGroupName here? otherwise, should always override with reorgMeta's

@ti-chi-bot ti-chi-bot bot added the lgtm label Sep 12, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glorv, zimulala

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 12, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 12, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-12 01:49:58.144128598 +0000 UTC m=+320380.068684978: ☑️ agreed by zimulala.
  • 2023-09-12 02:44:27.554418701 +0000 UTC m=+323649.478975096: ☑️ agreed by glorv.

@okJiang
Copy link
Member Author

okJiang commented Sep 12, 2023

/retest

@ti-chi-bot ti-chi-bot bot merged commit b7f0742 into pingcap:master Sep 12, 2023
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/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.

4 participants