smengcl opened a new pull request, #6046: URL: https://github.com/apache/ozone/pull/6046
## What changes were proposed in this pull request? Currently, only those keys in `KeyTable` would have metadata `HSYNC_CLIENT_ID` when those keys have been hsync'ed (and not closed/committed yet). The problem with this is that it makes `getExpiredOpenKeys()` and `listOpenKeys()` (HDDS-8830) inefficient by forcing them to look up `KeyTable` while they could have just used `OpenKeyTable` solely to determine whether an open key is hsync'ed or not. ### Changes 1. During key `hsync()`, persist metadata `HSYNC_CLIENT_ID` to `OmKeyInfo` in `OpenKeyTable` as well, in addition to `KeyTable`. Only write when the client ID changes so it doesn't lead to excessive writes. Ideally, only the first hsync() would lead to a `OpenKeyTable` write of that key. 2. During key `close()`, remove `HSYNC_CLIENT_ID` from OpenKeyTable if any, so that `HSYNC_CLIENT_ID` isn't unnecessarily written to the final key (which is useless when the key is committed/finalized. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-10077 ## How was this patch tested? - [x] Existing tests that cover the changes shall pass. - [ ] Add new UT to cover the intended behavior. - When a key is newly created/opened, neither OpenKeyTable nor KeyTable should have hsync metadata. - When the key is hsync'ed, both OpenKeyTable and KeyTable should have hsync metadata. - When the key is hsync'ed again, both OpenKeyTable and KeyTable should have hsync metadata. - When the key is closed, KeyTable entry should no longer have hsync metadata. Key should not exist in OpenKeyTable. - All three types of buckets (LEGACY/OBS/FSO) should behave the same. -- 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]
