Skip to content

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

@D3Hunter

Description

@D3Hunter

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions