[
https://issues.apache.org/jira/browse/TAJO-704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096464#comment-14096464
]
ASF GitHub Bot commented on TAJO-704:
-------------------------------------
Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/77#discussion_r16218650
--- Diff: tajo-common/src/main/java/org/apache/tajo/util/HAServiceUtil.java
---
@@ -0,0 +1,297 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.util;
+
+import org.apache.hadoop.fs.*;
+import org.apache.tajo.TajoConstants;
+import org.apache.tajo.conf.TajoConf;
+
+import javax.net.SocketFactory;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+
+public class HAServiceUtil {
+
+ private final static int MASTER_UMBILICAL_RPC_ADDRESS = 1;
+ private final static int MASTER_CLIENT_RPC_ADDRESS = 2;
+ private final static int RESOURCE_TRACKER_RPC_ADDRESS = 3;
+ private final static int CATALOG_ADDRESS = 4;
+ private final static int MASTER_INFO_ADDRESS = 5;
+
+ public static InetSocketAddress getMasterUmbilicalAddress(TajoConf conf)
{
+ return getMasterAddress(conf, MASTER_UMBILICAL_RPC_ADDRESS);
+ }
+
+ public static String getMasterUmbilicalName(TajoConf conf) {
+ return
NetUtils.normalizeInetSocketAddress(getMasterUmbilicalAddress(conf));
+ }
+
+ public static InetSocketAddress getMasterClientAddress(TajoConf conf) {
+ return getMasterAddress(conf, MASTER_CLIENT_RPC_ADDRESS);
+ }
+
+ public static String getMasterClientName(TajoConf conf) {
+ return
NetUtils.normalizeInetSocketAddress(getMasterClientAddress(conf));
+ }
+
+ public static InetSocketAddress getResourceTrackerAddress(TajoConf conf)
{
+ return getMasterAddress(conf, RESOURCE_TRACKER_RPC_ADDRESS);
+ }
+
+ public static String getResourceTrackerName(TajoConf conf) {
+ return
NetUtils.normalizeInetSocketAddress(getResourceTrackerAddress(conf));
+ }
+
+ public static InetSocketAddress getCatalogAddress(TajoConf conf) {
+ return getMasterAddress(conf, CATALOG_ADDRESS);
+ }
+
+ public static String getCatalogName(TajoConf conf) {
+ return NetUtils.normalizeInetSocketAddress(getCatalogAddress(conf));
+ }
+
+ public static InetSocketAddress getMasterInfoAddress(TajoConf conf) {
+ return getMasterAddress(conf, MASTER_INFO_ADDRESS);
+ }
+
+ public static String getMasterInfoName(TajoConf conf) {
+ return NetUtils.normalizeInetSocketAddress(getMasterInfoAddress(conf));
+ }
+
+ public static InetSocketAddress getMasterAddress(TajoConf conf, int
type) {
+ InetSocketAddress masterAddress = null;
+
+ if (conf.getBoolVar(TajoConf.ConfVars.TAJO_MASTER_HA_ENABLE)) {
+ try {
+ FileSystem fs = getFileSystem(conf);
+ Path[] paths = getSystemPath(conf);
+
+ if (fs.exists(paths[1])) {
+ FileStatus[] files = fs.listStatus(paths[1]);
+
+ if (files.length == 1) {
+ Path file = files[0].getPath();
+ String hostAddress = file.getName().replaceAll("_", ":");
+ FSDataInputStream stream = fs.open(file);
+ String data = stream.readUTF();
+ stream.close();
+
+ String[] addresses = data.split("_");
+
+ switch (type) {
+ case 1:
--- End diff --
It would be great if you use the defined name instead of defined values.
> TajoMaster HA
> -------------
>
> Key: TAJO-704
> URL: https://issues.apache.org/jira/browse/TAJO-704
> Project: Tajo
> Issue Type: New Feature
> Components: tajo master
> Affects Versions: 0.9.0
> Reporter: Jaehwa Jung
> Assignee: Jaehwa Jung
> Fix For: 0.9.0
>
> Attachments: TAJO-704.Henrick.01.patch.txt, TajoMasterHAdraft.pdf
>
>
> TajoMaster is a Single Point of Failure in a Tajo Cluster because TajoMaster
> is the central controlling entity for all components of the Tajo system.
> TajoMaster failure prevents clients from submitting new queries to the
> cluster, and results in the disruption of the ability to run insert overwrite
> queries because the TajoWorker can’t apply its statistical information to
> CatalogStore. Therefore, the high-availability (HA) of TajoMaster is
> essential for the high-availability of Tajo generally.
--
This message was sent by Atlassian JIRA
(v6.2#6252)