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 AilinKid committed Jan 17, 2024
1 parent e8081c3 commit ac771df
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/importer/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,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

Expand Down
2 changes: 0 additions & 2 deletions br/pkg/lightning/importer/table_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,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() {
Expand All @@ -976,7 +975,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, errors.Trace(err)
Expand Down

0 comments on commit ac771df

Please sign in to comment.