@@ -8,7 +8,10 @@ package logic
8
8
import (
9
9
gosql "database/sql"
10
10
"fmt"
11
+ << << << < HEAD
11
12
"sync"
13
+ == == == =
14
+ >> >> >> > b7db8c6 (Merge pull request #1180 from lmtwga / master )
12
15
"strings"
13
16
"sync/atomic"
14
17
"time"
@@ -885,7 +888,7 @@ func (this *Applier) CreateAtomicCutOverSentryTable() error {
885
888
}
886
889
887
890
// AtomicCutOverMagicLock
888
- func (this * Applier ) AtomicCutOverMagicLock (sessionIdChan chan int64 , tableLocked chan <- error , okToUnlockTable <- chan bool , tableUnlocked chan <- error , dropCutOverSentryTableOnce * sync. Once ) error {
891
+ func (this * Applier ) AtomicCutOverMagicLock (sessionIdChan chan int64 , tableLocked chan <- error , okToUnlockTable <- chan bool , tableUnlocked chan <- error ) error {
889
892
tx , err := this .db .Begin ()
890
893
if err != nil {
891
894
tableLocked <- err
@@ -896,6 +899,7 @@ func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocke
896
899
tableLocked <- fmt .Errorf ("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads" )
897
900
tableUnlocked <- fmt .Errorf ("Unexpected error in AtomicCutOverMagicLock(), injected to release blocking channel reads" )
898
901
tx .Rollback ()
902
+ this .DropAtomicCutOverSentryTableIfExists ()
899
903
}()
900
904
901
905
var sessionId int64
@@ -964,12 +968,10 @@ func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocke
964
968
sql .EscapeName (this .migrationContext .GetOldTableName ()),
965
969
)
966
970
967
- dropCutOverSentryTableOnce .Do (func () {
968
- if _ , err := tx .Exec (query ); err != nil {
969
- this .migrationContext .Log .Errore (err )
970
- // We DO NOT return here because we must `UNLOCK TABLES`!
971
- }
972
- })
971
+ if _ , err := tx .Exec (query ); err != nil {
972
+ this .migrationContext .Log .Errore (err )
973
+ // We DO NOT return here because we must `UNLOCK TABLES`!
974
+ }
973
975
974
976
// Tables still locked
975
977
this .migrationContext .Log .Infof ("Releasing lock from %s.%s, %s.%s" ,
0 commit comments