smengcl commented on PR #4567: URL: https://github.com/apache/ozone/pull/4567#issuecomment-1535591440
@GeorgeJahad In the latest commit posted 8b57f1f , I wrapped `OmSnapshot` inside `ReferenceCounted<>` so it becomes `ReferenceCounted<OmSnapshot>` in the cache `dbMap`. The plan is to replace every single instance of `OmSnapshot` with `ReferenceCounted<OmSnapshot>` in the rest of Ozone code so that they could be auto-closed with try-with-resources. This would involve quite a few changes: 1. `IOmMetadataReader` would need to be wrapped as `ReferenceCounted<IOmMetadataReader>` as well. (10 usages in 6 files) 2. Every single call to `OmSnapshotManager#checkForSnapshot` would now need to be wrapped inside try-with-resources. (10 usages in 6 files excluding tests) 3. Need to wrap active DB's `OmMetadataReader` in `ReferenceCounted<>` as well due to its usage in `checkForSnapshot()`, although reference counting wouldn't be useful to active OM DB. 4. `snapshotCache.get()` usages would need to be checked now that it returns `ReferenceCounted<OmSnapshot>`. (5 usages in 2 files) 5. SnapDiff might not be able to use try-with-resources. Rather it would need to call `snapshotCache.release()` manually when a SnapDiff job is done on both DB instances (`fromDB` and `toDB`. CMIIW @hemantk-12 I will postpone further work on this until #4642 is merged to avoid stepped on each others' toes. -- 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]
