HDFS-13862. RBF: Router logs are not capturing few of the dfsrouteradmin commands. Contributed by Ayush Saxena

This commit is contained in:
Brahma Reddy Battula 2018-09-09 23:20:26 +05:30
parent d924ca2e1a
commit 8944407d93

View File

@ -283,6 +283,13 @@ public EnterSafeModeResponse enterSafeMode(EnterSafeModeRequest request)
this.router.updateRouterState(RouterServiceState.SAFEMODE);
safeModeService.setManualSafeMode(true);
success = verifySafeMode(true);
if (success) {
LOG.info("STATE* Safe mode is ON.\n" + "It was turned on manually. "
+ "Use \"hdfs dfsrouteradmin -safemode leave\" to turn"
+ " safe mode off.");
} else {
LOG.error("Unable to enter safemode.");
}
}
return EnterSafeModeResponse.newInstance(success);
}
@ -296,6 +303,11 @@ public LeaveSafeModeResponse leaveSafeMode(LeaveSafeModeRequest request)
this.router.updateRouterState(RouterServiceState.RUNNING);
safeModeService.setManualSafeMode(false);
success = verifySafeMode(false);
if (success) {
LOG.info("STATE* Safe mode is OFF.\n" + "It was turned off manually.");
} else {
LOG.error("Unable to leave safemode.");
}
}
return LeaveSafeModeResponse.newInstance(success);
}
@ -307,6 +319,7 @@ public GetSafeModeResponse getSafeMode(GetSafeModeRequest request)
RouterSafemodeService safeModeService = this.router.getSafemodeService();
if (safeModeService != null) {
isInSafeMode = safeModeService.isInSafeMode();
LOG.info("Safemode status retrieved successfully.");
}
return GetSafeModeResponse.newInstance(isInSafeMode);
}
@ -340,6 +353,11 @@ public DisableNameserviceResponse disableNameservice(
boolean success = false;
if (namespaceExists(nsId)) {
success = getDisabledNameserviceStore().disableNameservice(nsId);
if (success) {
LOG.info("Nameservice {} disabled successfully.", nsId);
} else {
LOG.error("Unable to disable Nameservice {}", nsId);
}
} else {
LOG.error("Cannot disable {}, it does not exists", nsId);
}
@ -373,6 +391,11 @@ public EnableNameserviceResponse enableNameservice(
boolean success = false;
if (disabled.contains(nsId)) {
success = store.enableNameservice(nsId);
if (success) {
LOG.info("Nameservice {} enabled successfully.", nsId);
} else {
LOG.error("Unable to enable Nameservice {}", nsId);
}
} else {
LOG.error("Cannot enable {}, it was not disabled", nsId);
}