Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
restore: change LoadAndDelete to Load + Delete
Browse files Browse the repository at this point in the history
  • Loading branch information
YuJuncen committed Sep 8, 2021
1 parent 5d72c06 commit 8612207
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/restore/pipeline_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,13 @@ func (b *tikvSender) registerTableIsRestoring(ts []CreatedTable) func() {
// till all tables provided are no more ‘current restoring’.
func (b *tikvSender) waitTablesDone(ts []CreatedTable) {
for _, t := range ts {
wg, ok := b.tableWaiters.LoadAndDelete(t.Table.ID)
wg, ok := b.tableWaiters.Load(t.Table.ID)
if !ok {
log.Panic("bug! table done before register!",
zap.Any("wait-table-map", b.tableWaiters),
zap.Stringer("table", t.Table.Name))
}
b.tableWaiters.Delete(t.Table.ID)
wg.(*sync.WaitGroup).Wait()
}
}
Expand Down

0 comments on commit 8612207

Please sign in to comment.