Skip to content

Commit bd2f9a0

Browse files
committed
Record atomic rename duration after completion
1 parent 30e0352 commit bd2f9a0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

go/logic/migrator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,6 @@ func (mgtr *Migrator) atomicCutOver() (err error) {
11021102
}
11031103
mgtr.migrationContext.Log.Infof("Connection holding lock on original table still exists")
11041104

1105-
metrics.RecordCutOverPhase(mgtr.migrationContext.Metrics, metrics.CutOverPhaseMagicRename, time.Since(phaseStartTime), nil)
1106-
11071105
// Now that we've found the RENAME blocking, AND the locking connection still alive,
11081106
// we know it is safe to proceed to release the lock
11091107

@@ -1118,9 +1116,11 @@ func (mgtr *Migrator) atomicCutOver() (err error) {
11181116
}
11191117
metrics.RecordCutOverPhase(mgtr.migrationContext.Metrics, metrics.CutOverPhaseUnlock, time.Since(unlockStartTime), nil)
11201118
if err := <-tablesRenamed; err != nil {
1119+
metrics.RecordCutOverPhase(mgtr.migrationContext.Metrics, metrics.CutOverPhaseMagicRename, time.Since(phaseStartTime), err)
11211120
return mgtr.migrationContext.Log.Errore(err)
11221121
}
11231122
mgtr.migrationContext.RenameTablesEndTime = time.Now()
1123+
metrics.RecordCutOverPhase(mgtr.migrationContext.Metrics, metrics.CutOverPhaseMagicRename, mgtr.migrationContext.RenameTablesEndTime.Sub(phaseStartTime), nil)
11241124

11251125
// ooh nice! We're actually truly and thankfully done
11261126
lockAndRenameDuration := mgtr.migrationContext.RenameTablesEndTime.Sub(mgtr.migrationContext.LockTablesStartTime)

0 commit comments

Comments
 (0)