Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/reportutils/reportutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,6 @@ func FindBestUnit[T num16Plus](count T) DataUnit {
// FmtBytes is a convenience that combines BytesToUnit with FindBestUnit.
// Use it to format a single count of bytes.
func FmtBytes[T num16Plus](count T) string {
return BytesToUnit(count, FindBestUnit(count))
unit := FindBestUnit(count)
return BytesToUnit(count, unit) + " " + string(unit)
}
11 changes: 5 additions & 6 deletions internal/verifier/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (verifier *Verifier) CheckWorker(ctxIn context.Context) error {
err = nil
}

if err != nil {
if err == nil {
verifier.logger.Debug().
Int("generation", generation).
Msgf("Check finished.")
Expand Down Expand Up @@ -432,11 +432,6 @@ func (verifier *Verifier) work(ctx context.Context, workerNum int) error {
duration := verifier.workerSleepDelayMillis * time.Millisecond

if duration > 0 {
verifier.logger.Debug().
Int("workerNum", workerNum).
Stringer("duration", duration).
Msg("No tasks found. Sleeping.")

time.Sleep(duration)
}

Expand All @@ -453,6 +448,8 @@ func (verifier *Verifier) work(ctx context.Context, workerNum int) error {
switch task.Type {
case verificationTaskVerifyCollection:
err := verifier.ProcessCollectionVerificationTask(ctx, workerNum, task)
verifier.workerTracker.Unset(workerNum)

if err != nil {
return err
}
Expand All @@ -464,6 +461,8 @@ func (verifier *Verifier) work(ctx context.Context, workerNum int) error {
}
case verificationTaskVerifyDocuments:
err := verifier.ProcessVerifyTask(ctx, workerNum, task)
verifier.workerTracker.Unset(workerNum)

if err != nil {
return err
}
Expand Down
49 changes: 28 additions & 21 deletions internal/verifier/migration_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,16 @@ func (verifier *Verifier) getDocumentsCursor(ctx context.Context, collection *mo
}
}
findCmd := append(bson.D{{"find", collection.Name()}}, findOptions...)
verifier.logger.Debug().
Interface("task", task.PrimaryKey).
Str("findCmd", fmt.Sprintf("%s", findCmd)).
Str("options", fmt.Sprintf("%v", *runCommandOptions)).
Msg("getDocuments findCmd.")

// Suppress this log for recheck tasks because the list of IDs can be
// quite long.
if len(task.Ids) == 0 {
verifier.logger.Debug().
Interface("task", task.PrimaryKey).
Str("findCmd", fmt.Sprintf("%s", findCmd)).
Str("options", fmt.Sprintf("%v", *runCommandOptions)).
Msg("getDocuments findCmd.")
}

return collection.Database().RunCommandCursor(ctx, findCmd, runCommandOptions)
}
Expand Down Expand Up @@ -595,16 +600,6 @@ func (verifier *Verifier) ProcessVerifyTask(ctx context.Context, workerNum int,
Interface("task", task.PrimaryKey).
Msg("Processing document comparison task.")

defer func() {
elapsed := time.Since(start)

verifier.logger.Debug().
Int("workerNum", workerNum).
Interface("task", task.PrimaryKey).
Stringer("timeElapsed", elapsed).
Msg("Finished document comparison task.")
}()

problems, docsCount, bytesCount, err := verifier.FetchAndCompareDocuments(
ctx,
task,
Expand Down Expand Up @@ -681,12 +676,24 @@ func (verifier *Verifier) ProcessVerifyTask(ctx context.Context, workerNum int,
}
}

return errors.Wrapf(
verifier.UpdateVerificationTask(ctx, task),
"failed to persist task %s's new status (%#q)",
task.PrimaryKey,
task.Status,
)
err = verifier.UpdateVerificationTask(ctx, task)

if err != nil {
return errors.Wrapf(
err,
"failed to persist task %s's new status (%#q)",
task.PrimaryKey,
task.Status,
)
}

verifier.logger.Debug().
Int("workerNum", workerNum).
Interface("task", task.PrimaryKey).
Stringer("timeElapsed", time.Since(start)).
Msg("Finished document comparison task.")

return nil
}

func (verifier *Verifier) logChunkInfo(ctx context.Context, namespaceAndUUID *uuidutil.NamespaceAndUUID) {
Expand Down