Skip to content

HDDS-13365. OM support automatic table cache tracking and cleanup#10171

Open
ivandika3 wants to merge 6 commits intoapache:masterfrom
ivandika3:HDDS-13365
Open

HDDS-13365. OM support automatic table cache tracking and cleanup#10171
ivandika3 wants to merge 6 commits intoapache:masterfrom
ivandika3:HDDS-13365

Conversation

@ivandika3
Copy link
Copy Markdown
Contributor

@ivandika3 ivandika3 commented May 2, 2026

What changes were proposed in this pull request?

We need to ensure that the tables in CleanupTableInfo in OM response should be exactly the same as the ones updated in the corresponding OM request's validateAndUpdateCache. Previously, this is done with using CleanupTableInfo annotations on the OMClientResponse. However, this is hard to keep track because all the cache updates are done in the OMClientRequest, but we need to update the OMClientResponse instead, which is very error-prone. We should couple the table cache update in OMClientRequest and the tables to cleanup. That way, we remove the CleanupTableInfo reflection entirely.

One way is to track table cache to cleanup for the OmClientResponse whenever a cache is updated (e.g. using some context object). This will ensure that any table cache updated will eventually be cleaned up. Moreover, this can save some cleanup overhead if not all tables in the CleanupTableInfo need to be cleaned up in certain cases (e.g. OMOpenKeysDeleteRequest might only need to cleanup only OPEN_KEY_TABLE (if all the open keys are from OBS / LEGACY buckets) or OPEN_FILE_TABLE (if all the open keys are from FSO bucket) or both. For example, for each Table#addCacheEntry, we also need to update the list of tables to cleanup. However, there might be some memory overhead when passing the OM table cache to cleanup (although the context objects should be short-lived).

With this patch, we do not need to add any explicit CleanupTableInfo since all cache entry is eligible to be cleaned up as soon as it's added. This would make OM request/response development less error-prone and contributors do not need to worry about cache cleanup mechanism while developing OM request and response.

Note: Currently, the implementation uses ThreadLocal since currently OM validateAndUpdateCache only runs in a single thread (i.e. Ratis StateMachineUpdater) and the code changes is minimal. An alternative (less error-prone) idea is to pass tracker inside the ExecutionContext which should be safer, but will require changes in a lot more places.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13365

How was this patch tested?

UT (Clean CI: https://github.com/ivandika3/ozone/actions/runs/25242237805)

@ivandika3 ivandika3 self-assigned this May 2, 2026
@ivandika3 ivandika3 changed the title HDDS-13365. Ensure that CleanupTableInfo in OM response is synced with OM request HDDS-13365. OM support automatic cache tracking and cleanup May 2, 2026
@ivandika3 ivandika3 added the om label May 2, 2026
@ivandika3 ivandika3 marked this pull request as ready for review May 2, 2026 13:12
@ivandika3 ivandika3 requested a review from szetszwo May 2, 2026 13:20
@ivandika3 ivandika3 changed the title HDDS-13365. OM support automatic cache tracking and cleanup HDDS-13365. OM support automatic table cache tracking and cleanup May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant