Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
restore: ensure the ALTER TABLE step is also serial (#87)
Browse files Browse the repository at this point in the history
Prevent issue like TOOL-633
  • Loading branch information
kennytm authored Nov 24, 2018
1 parent bb97de3 commit 400ccdc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type RestoreController struct {
regionWorkers *RestoreWorkerPool
importer *kv.Importer
postProcessLock sync.Mutex // a simple way to ensure post-processing is not concurrent without using complicated goroutines
alterTableLock sync.Mutex

errorSummaries errorSummaries

Expand Down Expand Up @@ -534,7 +535,9 @@ func (t *TableRestore) postProcess(ctx context.Context, closedEngine *kv.ClosedE

// 3. alter table set auto_increment
if cp.Status < CheckpointStatusAlteredAutoInc {
rc.alterTableLock.Lock()
err := t.restoreTableMeta(ctx, rc.cfg)
rc.alterTableLock.Unlock()
rc.saveStatusCheckpoint(t.tableName, err, CheckpointStatusAlteredAutoInc)
if err != nil {
common.AppLogger.Errorf(
Expand Down

0 comments on commit 400ccdc

Please sign in to comment.