DDL: should we support to rollback from v7.1.0 to v6.5.1? #45570
Labels
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.3
component/ddl
This issue is related to DDL of TiDB.
type/enhancement
The issue or PR belongs to an enhancement.
Enhancement
I accidentally upgraded tidb(only tidb) from v6.5.1 to v7.1.0(master) successfully, with tikv and pd are still v6.5.1.
Now I would like to rollback tidb(only tidb) from v7.1.0 to v6.5.1 , however, it failed with error
it cames from the SQL: https://github.com/pingcap/tidb/blob/v6.5.1/session/session.go#L3090
The error was throwed by this function InitMDLTable https://github.com/pingcap/tidb/blob/v6.5.1/session/session.go#L3147-L3176
tidb/session/session.go
Lines 3147 to 3176 in 4084b07
in the transaction:
CheckMDLTableExist
tidb_mdl_info
not exist, so create it byCreateTableOrView
CreateTableOrView
run the sql to create thetidb-mdl-info
and meet already exist error, which is supposed not exist by step 1here comes the function
CheckMDLTableExists
https://github.com/pingcap/tidb/blob/v6.5.1/meta/meta.go#L616-L623tidb/meta/meta.go
Lines 616 to 623 in 4084b07
which means v6.5.1 the mDDLTableVersion should be []byte("2") when the mdl-table exists. So I believe v7.1.0 may changed the value of mDDLTableVersion. And I checked the same function on v7.1.0 and I think I've found the answer
https://github.com/pingcap/tidb/blob/v7.1.0/session/session.go#L3175-L3182
tidb/session/session.go
Lines 3175 to 3183 in 635a436
Which means v7.1.0 thinks if mDDLTableVersion >=2, mdl-table should exist.
And the value of
mDDLTableVersion
should be seted to3
byInitDDLJobTables(store, meta.BackfillTableVersion)
withBackfillTableVersion=3
on v7.1.0 functionBootstrapSession
tidb/session/session.go
Lines 3270 to 3290 in 635a436
Now let's get back to the most fundamental issue, how to rollback to v6.5.1 from v7.1.0 successfully? it seems hard to change the value of key
DDLTableVersion
to[]byte("2")
. And drop tabletidb_mdl_info
itself is a DDL job.And should we provide a workaround for this case?
The text was updated successfully, but these errors were encountered: