From c45d1e95e91a6d15fb52648f6d40155025b2b9b2 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 5 Jan 2024 13:47:17 +0800 Subject: [PATCH] lightning: remove alter table lock (#50074) close pingcap/tidb#50105 --- br/pkg/lightning/restore/restore.go | 7 +++---- br/pkg/lightning/restore/table_restore.go | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/br/pkg/lightning/restore/restore.go b/br/pkg/lightning/restore/restore.go index 6665bbecf0a4b..be5446f66d1f2 100644 --- a/br/pkg/lightning/restore/restore.go +++ b/br/pkg/lightning/restore/restore.go @@ -209,10 +209,9 @@ type Controller struct { tidbGlue glue.Glue pdCli pd.Client - alterTableLock sync.Mutex - sysVars map[string]string - tls *common.TLS - checkTemplate Template + sysVars map[string]string + tls *common.TLS + checkTemplate Template errorSummaries errorSummaries diff --git a/br/pkg/lightning/restore/table_restore.go b/br/pkg/lightning/restore/table_restore.go index d0afbc4cfac04..3d0c2a8602b76 100644 --- a/br/pkg/lightning/restore/table_restore.go +++ b/br/pkg/lightning/restore/table_restore.go @@ -752,7 +752,6 @@ func (tr *TableRestore) postProcess( // 3. alter table set auto_increment if cp.Status < checkpoints.CheckpointStatusAlteredAutoInc { - rc.alterTableLock.Lock() tblInfo := tr.tableInfo.Core var err error if tblInfo.ContainsAutoRandomBits() { @@ -777,7 +776,6 @@ func (tr *TableRestore) postProcess( err = rebaseGlobalAutoID(ctx, adjustIDBase(newBase), tr, tr.dbInfo.ID, tr.tableInfo.Core) } } - rc.alterTableLock.Unlock() saveCpErr := rc.saveStatusCheckpoint(ctx, tr.tableName, checkpoints.WholeTableEngineID, err, checkpoints.CheckpointStatusAlteredAutoInc) if err = firstErr(err, saveCpErr); err != nil { return false, err