Gargi-jais11 commented on code in PR #9904:
URL: https://github.com/apache/ozone/pull/9904#discussion_r2929237128


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStoreAbstractIterator.java:
##########


Review Comment:
   **DB closed between hasNext() and next()**
   You can understand it well with the below example where the above will 
basically help :
   
   **Scenario 1:**
   [scenario 1 
.pdf](https://github.com/user-attachments/files/25961119/scenario.1.pdf)
   So the loop exits with an exception instead of a normal “no more elements” 
exit as both before thead A could set the currentEntry thread B already closed 
the db and sets it to null.
   
   **Scenario 2:**
   Here comes the place where fix actually helps : when `currentEntry != null` 
means thread A has called`setCurrentEntry() `has populated currentEntry but 
after that thread B sets `dbClosed` true so now for thread a since we have a 
correct entry we will return the entry which is the desired case.
   
[scenario2.pdf](https://github.com/user-attachments/files/25961192/scenario2.pdf)
   
   
   



-- 
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