Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/77#discussion_r16218468
--- Diff: tajo-client/src/main/java/org/apache/tajo/client/TajoAdmin.java
---
@@ -416,12 +420,41 @@ public void processKill(Writer writer, String
queryIdStr)
private void processMasters(Writer writer) throws ParseException,
IOException,
ServiceException, SQLException {
- String confMasterServiceAddr =
tajoClient.getConf().getVar(TajoConf.ConfVars.TAJO_MASTER_UMBILICAL_RPC_ADDRESS);
- InetSocketAddress masterAddress =
NetUtils.createSocketAddr(confMasterServiceAddr);
- writer.write(masterAddress.getHostName());
- writer.write("\n");
+ checkMasterStatus();
+ if (tajoConf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) {
+
+ List<String> list = HAServiceUtil.getMasters(tajoConf);
+ int i = 0;
+ for (String master : list) {
+ if (i > 0) {
+ writer.write(" ");
+ }
+ writer.write(master);
+ i++;
+ }
+ writer.write("\n");
+ } else {
+ String confMasterServiceAddr =
tajoClient.getConf().getVar(TajoConf.ConfVars.TAJO_MASTER_UMBILICAL_RPC_ADDRESS);
+ InetSocketAddress masterAddress =
NetUtils.createSocketAddr(confMasterServiceAddr);
+ writer.write(masterAddress.getHostName());
+ writer.write("\n");
+ }
}
+ // In TajoMaster HA mode, if TajoAdmin can't connect existing active
master,
+ // this should try to connect new active master.
+ private void checkMasterStatus() {
--- End diff --
TajoAdmin.checkMasterStatus() function has the same name and shares some
codes with TajoCli.checkMasterStatus(). We can move these functions to one
location such as HAServiceUtil, because it will help the code maintainance.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---