Skip to content

HDDS-13927. Recon - OM Db delta updates handler resource cleanup.#9307

Merged
ArafatKhan2198 merged 2 commits intoapache:masterfrom
devmadhuu:HDDS-13927
Nov 24, 2025
Merged

HDDS-13927. Recon - OM Db delta updates handler resource cleanup.#9307
ArafatKhan2198 merged 2 commits intoapache:masterfrom
devmadhuu:HDDS-13927

Conversation

@devmadhuu
Copy link
Contributor

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.

@devmadhuu devmadhuu self-assigned this Nov 17, 2025
@devmadhuu devmadhuu requested a review from dombizita November 17, 2025 06:45
@devmadhuu devmadhuu marked this pull request as ready for review November 17, 2025 06:45
Copy link
Contributor

@ArafatKhan2198 ArafatKhan2198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @devmadhuu
Changes LGTM +1

@ArafatKhan2198 ArafatKhan2198 merged commit 4eb883f into apache:master Nov 24, 2025
55 checks passed
@adoroszlai
Copy link
Contributor

When merging PRs, please remove co-author information if it's the same person with different email address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants