bharatviswa504 commented on a change in pull request #703: HDDS-1371. Download
RocksDB checkpoint from OM Leader to Follower.
URL: https://github.com/apache/hadoop/pull/703#discussion_r290411303
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
##########
@@ -366,4 +374,99 @@ private static void addFilesToArchive(String source, File
file,
}
}
+ /**
+ * If a OM conf is only set with key suffixed with OM Node ID, return the
+ * set value.
+ * @return null if base conf key is set, otherwise the value set for
+ * key suffixed with Node ID.
+ */
+ public static String getConfSuffixedWithOMNodeId(Configuration conf,
+ String confKey, String omServiceID, String omNodeId) {
+ String confValue = conf.getTrimmed(confKey);
+ if (StringUtils.isNotEmpty(confValue)) {
+ return null;
+ }
+ String suffixedConfKey = OmUtils.addKeySuffixes(
+ confKey, omServiceID, omNodeId);
+ confValue = conf.getTrimmed(suffixedConfKey);
+ if (StringUtils.isNotEmpty(confValue)) {
+ return confValue;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the http address of peer OM node.
+ * @param conf Configuration
+ * @param omNodeId peer OM node ID
+ * @param omNodeHostAddr peer OM node host address
+ * @return http address of peer OM node in the format <hostName>:<port>
+ */
+ public static String getHttpAddressForOMPeerNode(Configuration conf,
+ String omServiceId, String omNodeId, String omNodeHostAddr) {
+ final Optional<String> bindHost = getHostNameFromConfigKeys(conf,
+ addKeySuffixes(OZONE_OM_HTTP_BIND_HOST_KEY, omServiceId, omNodeId));
+
+ final Optional<Integer> addressPort = getPortNumberFromConfigKeys(conf,
+ addKeySuffixes(OZONE_OM_HTTP_ADDRESS_KEY, omServiceId, omNodeId));
+
+ final Optional<String> addressHost = getHostNameFromConfigKeys(conf,
+ addKeySuffixes(OZONE_OM_HTTP_ADDRESS_KEY, omServiceId, omNodeId));
+
+ String hostName = bindHost.orElse(addressHost.orElse(omNodeHostAddr));
+
+ return hostName + ":" +
addressPort.orElse(OZONE_OM_HTTP_BIND_PORT_DEFAULT);
+ }
+
+ /**
+ * Returns the https address of peer OM node.
+ * @param conf Configuration
+ * @param omNodeId peer OM node ID
+ * @param omNodeHostAddr peer OM node host address
+ * @return http address of peer OM node in the format <hostName>:<port>
Review comment:
http address -> https address.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]