F64116045 commented on code in PR #11158:
URL: https://github.com/apache/ozone/pull/11158#discussion_r3889059160
##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java:
##########
@@ -622,11 +623,11 @@ protected void initializeConfiguration() throws
IOException {
}
private void configureHostAndRackTopology() throws IOException {
- FixedHostMapping.clear();
if (racks == null && hosts == null) {
return;
}
+ StaticMapping.resetMap();
Review Comment:
> Any good reason clear is called only if racks and hosts are specified?
Some callers configure StaticMapping directly instead of using the builder's
`setRacks()` or `setHosts()` methods. For example,
`TestStorageContainerManager` [configures StaticMapping
directly](https://github.com/F64116045/ozone/blob/8b95f2d1052416d0d0d1289b142493ca01d3b237/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManager.java#L646-L654)
and then [builds the cluster without calling setRacks() or
setHosts()](https://github.com/F64116045/ozone/blob/8b95f2d1052416d0d0d1289b142493ca01d3b237/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManager.java#L169-L177).
In that case, both racks and hosts are null, and resetting the map here would
erase the caller-provided mappings.
> StaticMapping is a static instance, so this can affect the subsequent test
after the topology related tests?
Yes. Thanks for catching this. I added cleanup to
`MiniOzoneClusterImpl.shutdown()` and added an assertion to verify that the
map is empty after cluster shutdown.
--
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]