getMigrationStateAndETA returns the state and eta of the migration.
(rowsEstimate int64)
| 1320 | |
| 1321 | // getMigrationStateAndETA returns the state and eta of the migration. |
| 1322 | func (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. |
| 1337 | func (mgtr *Migrator) shouldPrintStatus(rule PrintStatusRule, elapsedSeconds int64, etaDuration time.Duration) (shouldPrint bool) { |