@@ -459,7 +459,11 @@ func (verifier *Verifier) getDocumentsCursor(ctx context.Context, collection *mo
459459 }
460460 }
461461 findCmd := append (bson.D {{"find" , collection .Name ()}}, findOptions ... )
462- verifier .logger .Debug ().Msgf ("getDocuments findCmd: %s opts: %v" , findCmd , * runCommandOptions )
462+ verifier .logger .Debug ().
463+ Interface ("task" , task .PrimaryKey ).
464+ Str ("findCmd" , fmt .Sprintf ("%s" , findCmd )).
465+ Str ("options" , fmt .Sprintf ("%v" , * runCommandOptions )).
466+ Msg ("getDocuments findCmd." )
463467
464468 return collection .Database ().RunCommandCursor (ctx , findCmd , runCommandOptions )
465469}
@@ -540,7 +544,22 @@ func (verifier *Verifier) compareOneDocument(srcClientDoc, dstClientDoc bson.Raw
540544}
541545
542546func (verifier * Verifier ) ProcessVerifyTask (workerNum int , task * VerificationTask ) {
543- verifier .logger .Debug ().Msgf ("[Worker %d] Processing verify task" , workerNum )
547+ start := time .Now ()
548+
549+ verifier .logger .Debug ().
550+ Int ("workerNum" , workerNum ).
551+ Interface ("task" , task .PrimaryKey ).
552+ Msg ("Processing document comparison task." )
553+
554+ defer func () {
555+ elapsed := time .Since (start )
556+
557+ verifier .logger .Debug ().
558+ Int ("workerNum" , workerNum ).
559+ Interface ("task" , task .PrimaryKey ).
560+ Stringer ("timeElapsed" , elapsed ).
561+ Msg ("Finished document comparison task." )
562+ }()
544563
545564 problems , docsCount , bytesCount , err := verifier .FetchAndCompareDocuments (
546565 context .Background (),
@@ -549,7 +568,11 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
549568
550569 if err != nil {
551570 task .Status = verificationTaskFailed
552- verifier .logger .Error ().Msgf ("[Worker %d] Error comparing docs: %+v" , workerNum , err )
571+ verifier .logger .Error ().
572+ Err (err ).
573+ Int ("workerNum" , workerNum ).
574+ Interface ("task" , task .PrimaryKey ).
575+ Msg ("Failed to fetch and compare documents for document comparison task." )
553576 } else {
554577 task .SourceDocumentCount = docsCount
555578 task .SourceByteCount = bytesCount
@@ -560,10 +583,15 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
560583 task .Status = verificationTaskFailed
561584 // We know we won't change lastGeneration while verification tasks are running, so no mutex needed here.
562585 if verifier .lastGeneration {
563- verifier .logger .Error ().Msgf ("[Worker %d] Verification Task %+v failed critical section and is a true error" ,
564- workerNum , task .PrimaryKey )
586+ verifier .logger .Error ().
587+ Int ("workerNum" , workerNum ).
588+ Interface ("task" , task .PrimaryKey ).
589+ Msg ("Document comparison task failed critical section and is a true error." )
565590 } else {
566- verifier .logger .Debug ().Msgf ("[Worker %d] Verification Task %+v failed, may pass next generation" , workerNum , task .PrimaryKey )
591+ verifier .logger .Debug ().
592+ Int ("workerNum" , workerNum ).
593+ Interface ("task" , task .PrimaryKey ).
594+ Msg ("Document comparison task failed, but it may pass in the next generation." )
567595
568596 var mismatches []VerificationResult
569597 var missingIds []interface {}
@@ -594,15 +622,24 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
594622 // mismatched & missing docs.
595623 err := verifier .InsertFailedCompareRecheckDocs (task .QueryFilter .Namespace , idsToRecheck , dataSizes )
596624 if err != nil {
597- verifier .logger .Error ().Msgf ("[Worker %d] Error inserting document mismatch into Recheck queue: %+v" , workerNum , err )
625+ verifier .logger .Error ().
626+ Err (err ).
627+ Int ("workerNum" , workerNum ).
628+ Interface ("task" , task .PrimaryKey ).
629+ Int ("rechecksCount" , len (idsToRecheck )).
630+ Msg ("Failed to enqueue rechecks after document mismatches." )
598631 }
599632 }
600633 }
601634 }
602635
603636 err = verifier .UpdateVerificationTask (task )
604637 if err != nil {
605- verifier .logger .Error ().Msgf ("Failed updating verification status: %v" , err )
638+ verifier .logger .Error ().
639+ Err (err ).
640+ Int ("workerNum" , workerNum ).
641+ Interface ("task" , task .PrimaryKey ).
642+ Msg ("Failed to update task status." )
606643 }
607644}
608645
0 commit comments