Skip to content

Commit 91521f9

Browse files
author
Shlomi Noach
authored
Merge branch 'master' into old-table-name-timestamp
2 parents daf350b + 6b98151 commit 91521f9

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

go/logic/inspect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (this *Inspector) validateLogSlaveUpdates() error {
348348
}
349349

350350
if this.migrationContext.IsTungsten {
351-
log.Warning("log_slave_updates not found on %s:%d, but --tungsten provided, so I'm proceeding", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port)
351+
log.Warningf("log_slave_updates not found on %s:%d, but --tungsten provided, so I'm proceeding", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port)
352352
return nil
353353
}
354354

@@ -357,7 +357,7 @@ func (this *Inspector) validateLogSlaveUpdates() error {
357357
}
358358

359359
if this.migrationContext.InspectorIsAlsoApplier() {
360-
log.Warning("log_slave_updates not found on %s:%d, but executing directly on master, so I'm proceeeding", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port)
360+
log.Warningf("log_slave_updates not found on %s:%d, but executing directly on master, so I'm proceeeding", this.connectionConfig.Key.Hostname, this.connectionConfig.Key.Port)
361361
return nil
362362
}
363363

go/logic/migrator.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,13 @@ func (this *Migrator) iterateChunks() error {
10001000
for {
10011001
if atomic.LoadInt64(&this.rowCopyCompleteFlag) == 1 {
10021002
// Done
1003+
// There's another such check down the line
10031004
return nil
10041005
}
10051006
copyRowsFunc := func() error {
10061007
if atomic.LoadInt64(&this.rowCopyCompleteFlag) == 1 {
1007-
// Done
1008+
// Done.
1009+
// There's another such check down the line
10081010
return nil
10091011
}
10101012
hasFurtherRange, err := this.applier.CalculateNextIterationRangeEndValues()
@@ -1016,6 +1018,17 @@ func (this *Migrator) iterateChunks() error {
10161018
}
10171019
// Copy task:
10181020
applyCopyRowsFunc := func() error {
1021+
if atomic.LoadInt64(&this.rowCopyCompleteFlag) == 1 {
1022+
// No need for more writes.
1023+
// This is the de-facto place where we avoid writing in the event of completed cut-over.
1024+
// There could _still_ be a race condition, but that's as close as we can get.
1025+
// What about the race condition? Well, there's actually no data integrity issue.
1026+
// when rowCopyCompleteFlag==1 that means **guaranteed** all necessary rows have been copied.
1027+
// But some are still then collected at the binary log, and these are the ones we're trying to
1028+
// not apply here. If the race condition wins over us, then we just attempt to apply onto the
1029+
// _ghost_ table, which no longer exists. So, bothering error messages and all, but no damage.
1030+
return nil
1031+
}
10191032
_, rowsAffected, _, err := this.applier.ApplyIterationInsertQuery()
10201033
if err != nil {
10211034
return terminateRowIteration(err)

0 commit comments

Comments
 (0)