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

(cherry picked from commit 8944407d93)
This commit is contained in:
Brahma Reddy Battula 2018-09-09 23:20:26 +05:30
parent 0b97dc5869
commit cbcdaefa37
1 changed files with 23 additions and 0 deletions

View File

@ -283,6 +283,13 @@ public class RouterAdminServer extends AbstractService
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 class RouterAdminServer extends AbstractService
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 class RouterAdminServer extends AbstractService
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 class RouterAdminServer extends AbstractService
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 class RouterAdminServer extends AbstractService
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);
}