You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/07/30 13:34:22 UTC
[GitHub] [hadoop] slfan1989 commented on a diff in pull request #4662: HDFS-16705. RBF supports healthMonitor timeout configurable and caching NN and client proxy in NamenodeHeartbeatService
slfan1989 commented on code in PR #4662:
URL: https://github.com/apache/hadoop/pull/4662#discussion_r933807337
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/NamenodeHeartbeatService.java:
##########
@@ -399,13 +356,58 @@ private static String getNnHeartBeatServiceName(String nsId, String nnId) {
(nnId == null ? "" : " " + nnId);
}
+ /**
+ * Get the namespace information for a Namenode via RPC and add them to the report.
+ * @param serviceURI Server address of the Namenode to monitor.
+ * @param report Namenode status report updating with namespace information data.
+ */
+ private void updateNameSpaceInfoParameters(
+ URI serviceURI, NamenodeStatusReport report) throws IOException {
+ try {
+ if (this.namenodeProtocol == null) {
+ this.namenodeProtocol = NameNodeProxies.createProxy(this.conf, serviceURI,
+ NamenodeProtocol.class).getProxy();
+ }
+ if (namenodeProtocol != null) {
+ NamespaceInfo info = namenodeProtocol.versionRequest();
+ if (info != null) {
+ report.setNamespaceInfo(info);
+ }
+ }
+ } catch (IOException e) {
+ this.namenodeProtocol = null;
+ throw e;
+ }
+ }
+
+ /**
+ * Get the safemode information for a Namenode via RPC and add them to the report.
+ * @param serviceURI Server address of the Namenode to monitor.
+ * @param report Namenode status report updating with safemode information data.
+ */
+ private void updateSafeModeParameters(URI serviceURI, NamenodeStatusReport report) {
+ try {
+ if (this.clientProtocol == null) {
+ this.clientProtocol = NameNodeProxies
+ .createProxy(this.conf, serviceURI, ClientProtocol.class)
+ .getProxy();
+ }
+ if (clientProtocol != null) {
+ boolean isSafeMode = clientProtocol.setSafeMode(SafeModeAction.SAFEMODE_GET, false);
+ report.setSafeMode(isSafeMode);
+ }
+ } catch (Exception e) {
+ LOG.error("Cannot fetch safemode state for {}", getNamenodeDesc(), e);
Review Comment:
Exception why not throw?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org