From 5e1423c0a8eb4a01186097ef7adf1b9b1021b399 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Thu, 17 Oct 2024 14:19:16 +0800 Subject: [PATCH] ddl: fix exchange partition rollback might cause info schema full load (#56686) close pingcap/tidb#56685 --- pkg/ddl/schema_version.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ddl/schema_version.go b/pkg/ddl/schema_version.go index df302aba64408..c6eae800d3608 100644 --- a/pkg/ddl/schema_version.go +++ b/pkg/ddl/schema_version.go @@ -139,7 +139,9 @@ func SetSchemaDiffForExchangeTablePartition(diff *model.SchemaDiff, job *model.J diff.AffectedOpts = []*model.AffectedOption{{ TableID: args.PTTableID, }} - if job.SchemaState != model.StatePublic { + // when job state transit from rolling-back to rollback-done, the schema state + // is also public, diff.TableID should be the old non-partitioned table ID too. + if job.State == model.JobStateRollbackDone || job.SchemaState != model.StatePublic { // No change, just to refresh the non-partitioned table // with its new ExchangePartitionInfo. diff.TableID = job.TableID