MCPcopy Create free account
hub / github.com/Shopify/ghostferry / VerifyBeforeCutover

Method VerifyBeforeCutover

inline_verifier.go:419–452  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

417}
418
419func (v *InlineVerifier) VerifyBeforeCutover() error {
420 var timeToVerify time.Duration
421 // Iterate until the reverify queue is small enough
422 // Maximum 30 iterations.
423 for i := 0; i < 30; i++ {
424 before := v.reverifyStore.currentRowCount
425 start := time.Now()
426
427 _, mismatches, err := v.verifyAllEventsInStore()
428 if err != nil {
429 return err
430 }
431
432 v.readdMismatchedPaginationKeysToBeVerifiedAgain(mismatches)
433 after := v.reverifyStore.currentRowCount
434 timeToVerify = time.Now().Sub(start)
435
436 v.logger.WithFields(Fields{
437 "store_size_before": before,
438 "store_size_after": after,
439 "iteration": i,
440 }).Infof("completed re-verification iteration %d", i)
441
442 if after <= 1000 || after >= before {
443 break
444 }
445 }
446
447 if v.MaxExpectedDowntime != 0 && timeToVerify > v.MaxExpectedDowntime {
448 return fmt.Errorf("cutover stage verification will not complete within max downtime duration (took %s)", timeToVerify)
449 }
450
451 return nil
452}
453
454func formatMismatches(mismatches map[string]map[string][]InlineVerifierMismatches) (string, []string) {
455 // Build error message for display

Callers

nothing calls this directly

Calls 5

InfofMethod · 0.65
WithFieldsMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected