Skip to content

Commit

Permalink
lightning: remove alter table lock (pingcap#50074)
Browse files Browse the repository at this point in the history
  • Loading branch information
D3Hunter authored and ti-chi-bot committed Jan 5, 2024
1 parent cd073ea commit c45d1e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions br/pkg/lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions br/pkg/lightning/restore/table_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit c45d1e9

Please sign in to comment.