peterxcli opened a new pull request, #8360: URL: https://github.com/apache/ozone/pull/8360
## What changes were proposed in this pull request? If `VolumeChoosingPolicy#chooseVolume` is not synchronized and caller required space reserved before chooseVolume returns, there is no easy way to guarantee chosen volume will have enough space. `VolumeChoosingPolicy#chooseVolume` is used for create container and container import. Make `VolumeChoosingPolicy#chooseVolume` synchronized or part of chooseVolume synchronized will add some latency, which is negligible for container import, may noticeable for create container. We can compare the create container latency metrics with and without the synchronization. `VolumeChoosingPolicy#chooseVolume`, its Java Doc says "The implementations of this interface must be thread-safe.", regarding the space full check and space reservation, it can be done as an atomic operation in the chooseVolume internally, so that there will no over allocation of space due to concurrent container creation and container import. Also need to add test to check if committedBytes is checked in container creation unit tests and container import, container replication unit tests. Besides, we also need the unit tests to verify that if the container creation fails, container import fails, or container replication fails, the resevered committedBytes are released. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-12810 ## How was this patch tested? Added coverage of commit space would be reserved/released correctly when creating/importing containers in `TestKeyValueContainer`, `TestDownloadAndImportReplicator` and `TestSendContainerRequestHandler`. There're also some existing tests covering this change, like `TestContainerPerisistance` and `TestOzoneContainer`. CI: https://github.com/peterxcli/ozone/actions/runs/14730651116 -- 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]
