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

   ## What changes were proposed in this pull request?
   This PR is to do cleanup of resources like rocksDB tables references from 
OMDbUpdatesHandler in case of any exception or error in following scenarios:
   
   Specific Failure Scenarios When OMDbUpdatesHandler could still hold some 
references
   **Scenario 1: Exception During Batch Processing**
   ```
   try (OMDBUpdatesHandler omdbUpdatesHandler = new 
OMDBUpdatesHandler(omMetadataManager)) {
   
       for (byte[] data : dbUpdates.getData()) {
   
           try (ManagedWriteBatch writeBatch = new ManagedWriteBatch(data))
   
   {             writeBatch.iterate(omdbUpdatesHandler);  // Handler stores 
references to RocksDB objects                          // EXCEPTION OCCURS HERE 
(e.g., RocksDBException during commit)             
rdbBatchOperation.commit(rocksDB, wOpts);                        }
   // writeBatch.close() called, but omdbUpdatesHandler still holds references!
   
       }
   
   } // omdbUpdatesHandler "close" called, but it's a no-op since no close() 
method exists
   
   ```
    
   
   Result: RocksDB handles, iterators, and memory remain allocated indefinitely.
   
   **Scenario 2: Interrupted Thread**
   ```
   try (OMDBUpdatesHandler omdbUpdatesHandler = new 
OMDBUpdatesHandler(omMetadataManager)) {
   
       // Thread gets interrupted during long-running operation
   
       if (Thread.currentThread().isInterrupted())
   
   {         throw new InterruptedException("Thread interrupted during delta 
update.");     }
       // omdbUpdatesHandler has already accessed tables and created internal 
resources
   
       // Interrupt causes immediate exit without proper cleanup
   
   }
   ```
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-13927
   
   ## How was this patch tested?
   Tested the patch locally using docker cluster and existing tests.


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