@@ -540,7 +540,22 @@ func (verifier *Verifier) compareOneDocument(srcClientDoc, dstClientDoc bson.Raw
540540}
541541
542542func (verifier * Verifier ) ProcessVerifyTask (workerNum int , task * VerificationTask ) {
543- verifier .logger .Debug ().Msgf ("[Worker %d] Processing verify task" , workerNum )
543+ start := time .Now ()
544+
545+ verifier .logger .Debug ().
546+ Int ("workerNum" , workerNum ).
547+ Interface ("task" , task .PrimaryKey ).
548+ Msg ("Processing document comparison task." )
549+
550+ defer func () {
551+ elapsed := time .Now ().Sub (start )
552+
553+ verifier .logger .Debug ().
554+ Int ("workerNum" , workerNum ).
555+ Interface ("task" , task .PrimaryKey ).
556+ Stringer ("timeElapsed" , elapsed ).
557+ Msg ("Finished document comparison task." )
558+ }()
544559
545560 problems , docsCount , bytesCount , err := verifier .FetchAndCompareDocuments (
546561 context .Background (),
@@ -549,7 +564,11 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
549564
550565 if err != nil {
551566 task .Status = verificationTaskFailed
552- verifier .logger .Error ().Msgf ("[Worker %d] Error comparing docs: %+v" , workerNum , err )
567+ verifier .logger .Error ().
568+ Err (err ).
569+ Int ("workerNum" , workerNum ).
570+ Interface ("task" , task .PrimaryKey ).
571+ Msg ("Failed to fetch and compare documents for document comparison task." )
553572 } else {
554573 task .SourceDocumentCount = docsCount
555574 task .SourceByteCount = bytesCount
@@ -560,10 +579,15 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
560579 task .Status = verificationTaskFailed
561580 // We know we won't change lastGeneration while verification tasks are running, so no mutex needed here.
562581 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 )
582+ verifier .logger .Error ().
583+ Int ("workerNum" , workerNum ).
584+ Interface ("task" , task .PrimaryKey ).
585+ Msg ("Document comparison task failed critical section and is a true error." )
565586 } else {
566- verifier .logger .Debug ().Msgf ("[Worker %d] Verification Task %+v failed, may pass next generation" , workerNum , task .PrimaryKey )
587+ verifier .logger .Debug ().
588+ Int ("workerNum" , workerNum ).
589+ Interface ("task" , task .PrimaryKey ).
590+ Msg ("Document comparison task failed, but it may pass in the next generation." )
567591
568592 var mismatches []VerificationResult
569593 var missingIds []interface {}
@@ -594,15 +618,24 @@ func (verifier *Verifier) ProcessVerifyTask(workerNum int, task *VerificationTas
594618 // mismatched & missing docs.
595619 err := verifier .InsertFailedCompareRecheckDocs (task .QueryFilter .Namespace , idsToRecheck , dataSizes )
596620 if err != nil {
597- verifier .logger .Error ().Msgf ("[Worker %d] Error inserting document mismatch into Recheck queue: %+v" , workerNum , err )
621+ verifier .logger .Error ().
622+ Err (err ).
623+ Int ("workerNum" , workerNum ).
624+ Interface ("task" , task .PrimaryKey ).
625+ Int ("rechecksCount" , len (idsToRecheck )).
626+ Msg ("Failed to enqueue rechecks after document mismatches." )
598627 }
599628 }
600629 }
601630 }
602631
603632 err = verifier .UpdateVerificationTask (task )
604633 if err != nil {
605- verifier .logger .Error ().Msgf ("Failed updating verification status: %v" , err )
634+ verifier .logger .Error ().
635+ Err (err ).
636+ Int ("workerNum" , workerNum ).
637+ Interface ("task" , task .PrimaryKey ).
638+ Msg ("Failed to update task status." )
606639 }
607640}
608641
0 commit comments