MCPcopy
hub / github.com/github/gh-ost / getMigrationStateAndETA

Method getMigrationStateAndETA

go/logic/migrator.go:1322–1334  ·  view source on GitHub ↗

getMigrationStateAndETA returns the state and eta of the migration.

(rowsEstimate int64)

Source from the content-addressed store, hash-verified

1320
1321// getMigrationStateAndETA returns the state and eta of the migration.
1322func (mgtr *Migrator) getMigrationStateAndETA(rowsEstimate int64) (state, eta string, etaDuration time.Duration) {
1323 eta, etaDuration = mgtr.getMigrationETA(rowsEstimate)
1324 state = "migrating"
1325 if atomic.LoadInt64(&mgtr.migrationContext.CountingRowsFlag) > 0 && !mgtr.migrationContext.ConcurrentCountTableRows {
1326 state = "counting rows"
1327 } else if atomic.LoadInt64(&mgtr.migrationContext.IsPostponingCutOver) > 0 {
1328 eta = "due"
1329 state = "postponing cut-over"
1330 } else if isThrottled, throttleReason, _ := mgtr.migrationContext.IsThrottled(); isThrottled {
1331 state = fmt.Sprintf("throttled, %s", throttleReason)
1332 }
1333 return state, eta, etaDuration
1334}
1335
1336// shouldPrintStatus returns true when the migrator is due to print status info.
1337func (mgtr *Migrator) shouldPrintStatus(rule PrintStatusRule, elapsedSeconds int64, etaDuration time.Duration) (shouldPrint bool) {

Callers 2

printStatusMethod · 0.95

Calls 2

getMigrationETAMethod · 0.95
IsThrottledMethod · 0.80

Tested by 1