hevinhsu commented on code in PR #10598:
URL: https://github.com/apache/ozone/pull/10598#discussion_r3643128098
##########
hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneCluster.java:
##########
@@ -369,6 +382,36 @@ public Builder setDatanodeFactory(DatanodeFactory factory)
{
return this;
}
+ /**
+ * Sets the rack location for each datanode. The length of the array
+ * determines the number of datanodes to start. Each entry is a rack
+ * path such as {@code "/rack0"}.
+ *
+ * @param racks rack path per datanode
+ * @return this Builder
+ */
+ public Builder setRacks(String[] racks) {
+ this.racks = Arrays.copyOf(racks, racks.length);
+ this.numOfDatanodes = racks.length;
+ return this;
+ }
+
+ /**
+ * Sets the hostname for each datanode. When used together with
+ * {@link #setRacks}, the hostnames are used as keys in the
+ * {@code StaticMapping} instead of the default synthetic names
+ * ({@code "dn-0"}, {@code "dn-1"}, …). The length of the array must
+ * match the number of datanodes.
+ *
+ * @param hosts hostname per datanode
+ * @return this Builder
+ */
+ public Builder setHosts(String[] hosts) {
+ this.hosts = Arrays.copyOf(hosts, hosts.length);
+ this.numOfDatanodes = hosts.length;
+ return this;
+ }
Review Comment:
Thanks for the suggestion! Updated accordingly. `setHosts()` and
`setRacks()` no longer update `numOfDatanodes` implicitly, and the validation
is now performed in `build()`.
--
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]