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: do not reference owner_id for all system DDLs #53355

Merged
merged 3 commits into from
May 17, 2024

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented May 17, 2024

What problem does this PR solve?

Issue Number: close #53327

Problem Summary:

This PR is a patch for #53332.

Except mysql.tidb_mdl_info, there are other system DDLs during upgrade, we should avoid reference owner_id for all of them.

[2024/05/17 10:47:07.637 +08:00] [INFO] [session.go:3894] ["CRUCIAL OPERATION"] [conn=0] [schemaVersion=39] [cur_db=] [sql="ALTER TABLE mysql.stats_meta_history ADD COLUMN IF NOT EXISTS `source` varchar(40) NOT NULL after `version`;"] [user=]
[2024/05/17 10:47:07.717 +08:00] [INFO] [ddl_worker.go:261] ["add DDL jobs"] [category=ddl] ["batch count"=1] [jobs="ID:80, Type:add column, State:queueing, SchemaState:none, SchemaID:1, TableID:64, RowCount:0, ArgLen:4, start time: 2024-05-17 10:47:07.655 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false; "] [table=true]
[2024/05/17 10:47:07.717 +08:00] [INFO] [ddl.go:1181] ["start DDL job"] [category=ddl] [job="ID:80, Type:add column, State:queueing, SchemaState:none, SchemaID:1, TableID:64, RowCount:0, ArgLen:4, start time: 2024-05-17 10:47:07.655 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"] [query="ALTER TABLE mysql.stats_meta_history ADD COLUMN IF NOT EXISTS `source` varchar(40) NOT NULL after `version`;"]
...
[2024/05/17 10:47:08.625 +08:00] [INFO] [ddl_worker.go:1212] ["run DDL job"] [worker="worker 1, tp general"] [category=ddl] [jobID=80] [category=ddl] [job="ID:80, Type:add column, State:queueing, SchemaState:none, SchemaID:1, TableID:64, RowCount:0, ArgLen:0, start time: 2024-05-17 10:47:07.655 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"]
[2024/05/17 10:47:08.627 +08:00] [INFO] [column.go:135] ["run add column job"] [category=ddl] [job="ID:80, Type:add column, State:running, SchemaState:none, SchemaID:1, TableID:64, RowCount:0, ArgLen:4, start time: 2024-05-17 10:47:07.655 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"] [columnInfo="{\"id\":6,\"name\":{\"O\":\"source\",\"L\":\"source\"},\"offset\":5,\"origin_default\":\"\",\"origin_default_bit\":null,\"default\":null,\"default_bit\":null,\"default_is_expr\":false,\"generated_expr_string\":\"\",\"generated_stored\":false,\"dependences\":null,\"type\":{},\"state\":0,\"comment\":\"\",\"hidden\":false,\"change_state_info\":null,\"version\":2}"]
[2024/05/17 10:47:08.631 +08:00] [INFO] [job_table.go:466] ["handle ddl job failed"] [worker="worker 1, tp general"] [category=ddl] [error="[planner:1054]Unknown column 'owner_id' in 'field list'"] [job="ID:80, Type:add column, State:running, SchemaState:delete only, SchemaID:1, TableID:64, RowCount:0, ArgLen:4, start time: 2024-05-17 10:47:07.655 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"]

What changed and how does it work?

We skip reference owner_id field for all system DDLs.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    1. Prepare a v6.5.8 cluster.
    2. Kill v6.5.8 TiDB server.
    3. Start latest(compiled from this PR) TiDB server.
    4. Execute upgrade process normally. It can also serve users' DDL.
  • 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 release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 17, 2024
Copy link

tiprow bot commented May 17, 2024

Hi @tangenta. 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.

@tangenta tangenta changed the title ddl: do not reference owner_id for system DDLs ddl: do not reference owner_id for all system DDLs May 17, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 17, 2024
Copy link

ti-chi-bot bot commented May 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, wjhuang2016

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 May 17, 2024
Copy link

ti-chi-bot bot commented May 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-17 07:06:37.014181968 +0000 UTC m=+1809750.771317526: ☑️ agreed by wjhuang2016.
  • 2024-05-17 07:16:22.233640481 +0000 UTC m=+1810335.990776054: ☑️ agreed by lance6716.

@tangenta tangenta added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.5945%. Comparing base (5d990c6) to head (3ae64a4).
Report is 4 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53355        +/-   ##
================================================
+ Coverage   72.4968%   74.5945%   +2.0976%     
================================================
  Files          1505       1505                
  Lines        429835     429931        +96     
================================================
+ Hits         311617     320705      +9088     
+ Misses        98885      89321      -9564     
- Partials      19333      19905       +572     
Flag Coverage Δ
integration 49.1705% <100.0000%> (?)
unit 71.3315% <100.0000%> (-0.0633%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.4334% <ø> (+9.0600%) ⬆️

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented May 17, 2024

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

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented May 17, 2024

@tangenta: 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 2037a2f into pingcap:master May 17, 2024
23 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #53367.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade TiDB failed: unknown column 'owner_id' in field list
4 participants