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

modify column keeps writing temp column to tableinfo during upgrade from 8.1 -> 8.5, when there are multiple owners #58843

Closed
D3Hunter opened this issue Jan 9, 2025 · 1 comment · Fixed by #58855
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. component/ddl This issue is related to DDL of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@D3Hunter
Copy link
Contributor

D3Hunter commented Jan 9, 2025

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  • during upgrade, trigger this issue multiple owner might exist at same time if keys are delete manually #54689 on the older node A
  • during the upgrade there is a ALTER TABLE mysql.tidb_runaway_queries MODIFY COLUMN plan_digest varchar(64) DEFAULT ''; submitted by the 8.5 node which will force to be owner, and the job is using v1 args, but it contains 8 args, below is the code of 8.5.0
    func (a *ModifyColumnArgs) getArgsV1(*Job) []any {
    return []any{
    a.Column, a.OldColumnName, a.Position, a.ModifyColumnType,
    a.NewShardBits, a.ChangingColumn, a.ChangingIdxs, a.RedundantIdxs,
    }
  • if the job is run on A, it will append args, but A only uses the first 8, the appended args is useless.
    • if the job is created by older version, the job will only have 5 args initially, will append args will work, below is the code of 8.1.0
      Args: []any{&newCol.ColumnInfo, originalColName, spec.Position, modifyColumnTp, newAutoRandBits},
  • so modifyInfo.changingCol is nil all the time, and it's initialized and inserted into the tableinfo every time(code of 8.1.0):

    tidb/pkg/ddl/column.go

    Lines 570 to 571 in 945d07c

    changingCol := modifyInfo.changingCol
    if changingCol == nil {
  • as node A keeps running the job, we got a tableinfo like this:
{
  "id": 432102,
  "name": {
   "O": "tidb_runaway_queries",
   "L": "tidb_runaway_queries"
  },
  "charset": "utf8mb4",
  "collate": "utf8mb4_bin",
  "cols": [
..... other columns
  {
    "id": 3546,
    "name": {
     "O": "_Col$_plan_digest_3536",
     "L": "_col$_plan_digest_3536"
    },
    "offset": 3545,
.....
}

2. What did you expect to see? (Required)

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

see title

@D3Hunter D3Hunter added type/bug The issue is confirmed as a bug. severity/major affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. labels Jan 9, 2025
@ti-chi-bot ti-chi-bot bot added may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-8.5 labels Jan 9, 2025
@D3Hunter D3Hunter added affects-8.5 This bug affects the 8.5.x(LTS) versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-8.5 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. labels Jan 9, 2025
@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label Jan 10, 2025
@ti-chi-bot ti-chi-bot bot closed this as completed in e43a14e Jan 10, 2025
@D3Hunter
Copy link
Contributor Author

I checked all other jobs and found drop column also have the args count mismatch issue, but it won't cause any harm as we don't drop column during upgrade right now, see #58863

@D3Hunter D3Hunter changed the title modify column keeps in writing temp column to tableinfo during upgrade from 8.1 -> 8.5, when there are multiple owners modify column keeps writing temp column to tableinfo during upgrade from 8.1 -> 8.5, when there are multiple owners Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. component/ddl This issue is related to DDL of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants