From 7caa282dbb8d86c1b296f65208d039c1bff02ca9 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Wed, 24 Jan 2024 10:57:20 +0800 Subject: [PATCH] lightning: remove alter table lock (#50074) (#50116) 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