ArafatKhan2198 opened a new pull request, #11934:
URL: https://github.com/apache/ozone/pull/11934

   ### **What changes were proposed in this pull request?**
   
   When a Recon task **returns** a failure, Recon retries the batch and 
reinitializes the tasks if the retry fails too. But when a task **throws** an 
exception, Recon only logs it and moves on, so that batch is lost for that task.
   
   **Example:**
   
   1. Batch 1: "key K1 created, 1000 bytes". `FileSizeCountTask` throws while 
saving, so K1 is not counted.
   2. Recon logs the error. No retry, no reinitialization.
   3. Batch 2 succeeds, and the task's sequence number moves past batch 1.
   4. K1 is missing from the file size counts for good, and nothing notices.
   
   **Fix:** in the `exceptionally` branch of `processTasks`, add the task to 
`failedTasks`, so a thrown exception is handled like a returned failure (retry, 
then reinitialize). `failedTasks` and `retryFailedTasks` also become 
synchronized lists, since several threads add to them at the same time.
   
   Retrying is safe because the affected tasks save each batch in one atomic 
write: if the task threw, nothing from that batch was saved. This is a safety 
net for unexpected errors such as bugs; normal operation doesn't trigger it.
   
   ### **What is the link to the Apache JIRA**
   
   https://issues.apache.org/jira/browse/HDDS-17040
   
   ### **How was this patch tested?**
   
   - Updated `testTaskRecordsFailureOnException`: a task that always throws is 
retried, then requests reinitialization.
   - New `testTaskThrowingOnceIsRetried`: a task that throws once is retried 
and succeeds.
   - The Recon task controller and task suites pass, and checkstyle is clean.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to