()
| 417 | } |
| 418 | |
| 419 | func (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 | |
| 454 | func formatMismatches(mismatches map[string]map[string][]InlineVerifierMismatches) (string, []string) { |
| 455 | // Build error message for display |
nothing calls this directly
no test coverage detected