Skip to content

Commit b79a9e7

Browse files
authored
Revert "Merge in github#755" (#16)
This reverts commit 0e2d33a.
1 parent 6209cf6 commit b79a9e7

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

go/logic/applier.go

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package logic
88
import (
99
gosql "database/sql"
1010
"fmt"
11-
"sync"
1211
"sync/atomic"
1312
"time"
1413

@@ -834,7 +833,7 @@ func (this *Applier) CreateAtomicCutOverSentryTable() error {
834833
}
835834

836835
// AtomicCutOverMagicLock
837-
func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocked chan<- error, okToUnlockTable <-chan bool, tableUnlocked chan<- error, dropCutOverSentryTableOnce *sync.Once) error {
836+
func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocked chan<- error, okToUnlockTable <-chan bool, tableUnlocked chan<- error) error {
838837
tx, err := this.db.Begin()
839838
if err != nil {
840839
tableLocked <- err
@@ -912,13 +911,10 @@ func (this *Applier) AtomicCutOverMagicLock(sessionIdChan chan int64, tableLocke
912911
sql.EscapeName(this.migrationContext.DatabaseName),
913912
sql.EscapeName(this.migrationContext.GetOldTableName()),
914913
)
915-
916-
dropCutOverSentryTableOnce.Do(func() {
917-
if _, err := tx.Exec(query); err != nil {
918-
this.migrationContext.Log.Errore(err)
919-
// We DO NOT return here because we must `UNLOCK TABLES`!
920-
}
921-
})
914+
if _, err := tx.Exec(query); err != nil {
915+
this.migrationContext.Log.Errore(err)
916+
// We DO NOT return here because we must `UNLOCK TABLES`!
917+
}
922918

923919
// Tables still locked
924920
this.migrationContext.Log.Infof("Releasing lock from %s.%s, %s.%s",

go/logic/migrator.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"math"
1313
"os"
1414
"strings"
15-
"sync"
1615
"sync/atomic"
1716
"time"
1817

@@ -644,12 +643,9 @@ func (this *Migrator) atomicCutOver() (err error) {
644643
defer atomic.StoreInt64(&this.migrationContext.InCutOverCriticalSectionFlag, 0)
645644

646645
okToUnlockTable := make(chan bool, 4)
647-
var dropCutOverSentryTableOnce sync.Once
648646
defer func() {
649647
okToUnlockTable <- true
650-
dropCutOverSentryTableOnce.Do(func() {
651-
this.applier.DropAtomicCutOverSentryTableIfExists()
652-
})
648+
this.applier.DropAtomicCutOverSentryTableIfExists()
653649
}()
654650

655651
atomic.StoreInt64(&this.migrationContext.AllEventsUpToLockProcessedInjectedFlag, 0)
@@ -658,7 +654,7 @@ func (this *Migrator) atomicCutOver() (err error) {
658654
tableLocked := make(chan error, 2)
659655
tableUnlocked := make(chan error, 2)
660656
go func() {
661-
if err := this.applier.AtomicCutOverMagicLock(lockOriginalSessionIdChan, tableLocked, okToUnlockTable, tableUnlocked, &dropCutOverSentryTableOnce); err != nil {
657+
if err := this.applier.AtomicCutOverMagicLock(lockOriginalSessionIdChan, tableLocked, okToUnlockTable, tableUnlocked); err != nil {
662658
this.migrationContext.Log.Errore(err)
663659
}
664660
}()

0 commit comments

Comments
 (0)