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

   ## What changes were proposed in this pull request?
   When `StorageVolumeChecker` detects a volume failure and calls 
`failVolume()`, it closes the underlying RocksDB instance while 
`BackgroundContainerDataScanner` or `OnDemandContainerScanner` may still hold 
an active iterator over that DB, calling native RocksDB methods on a closed DB 
can cause a crash. This fix adds two complementary guards to 
`RDBStoreAbstractIterator`: a fast-fail check so `hasNext()` returns false 
immediately once the DB is closed (stopping the scan loop without touching 
native code), and reference counting by acquiring a slot on 
RocksDatabase.counter at iterator creation and releasing it on close(), so the 
existing `waitAndClose() `mechanism waits for all iterators to finish before 
physically closing the DB. Together these ensure the scan exits cleanly and the 
DB cannot be destroyed while an iterator is still in use.
   
   ## What is the link to the Apache JIRA
   
   HDDS-14800
   
   ## How was this patch tested?
   
   Tested using added unit test cases.
   


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