From 72a4ef2b45df781f4c214515e576d46427d272ea 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/importer/import.go | 7 +++---- br/pkg/lightning/importer/table_import.go | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/br/pkg/lightning/importer/import.go b/br/pkg/lightning/importer/import.go index 0fbb7f74205c4..b5cd1262fa98b 100644 --- a/br/pkg/lightning/importer/import.go +++ b/br/pkg/lightning/importer/import.go @@ -208,10 +208,9 @@ type Controller struct { db *sql.DB 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/importer/table_import.go b/br/pkg/lightning/importer/table_import.go index c1da1972b8c1f..4371dacd1ce29 100644 --- a/br/pkg/lightning/importer/table_import.go +++ b/br/pkg/lightning/importer/table_import.go @@ -896,7 +896,6 @@ func (tr *TableImporter) postProcess( // alter table set auto_increment if cp.Status < checkpoints.CheckpointStatusAlteredAutoInc { - rc.alterTableLock.Lock() tblInfo := tr.tableInfo.Core var err error if tblInfo.ContainsAutoRandomBits() { @@ -921,7 +920,6 @@ func (tr *TableImporter) postProcess( err = common.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