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

restore: ensure the ALTER TABLE step is also serial #87

Merged
merged 1 commit into from
Nov 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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