Repository: hbase
Updated Branches:
  refs/heads/branch-1 dac73eceb -> a6397e3b0
  refs/heads/master 07757501d -> 12eec5bc5


HBASE-16938 TableCFsUpdater maybe failed due to no write permission on peerNode

Signed-off-by: Enis Soztutar <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/12eec5bc
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/12eec5bc
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/12eec5bc

Branch: refs/heads/master
Commit: 12eec5bc5d93d4af71bfd638b5b9fb302dbf8fd7
Parents: 0775750
Author: Guanghao Zhang <[email protected]>
Authored: Tue Oct 25 09:50:47 2016 +0800
Committer: Enis Soztutar <[email protected]>
Committed: Thu Nov 10 14:04:28 2016 -0800

----------------------------------------------------------------------
 .../replication/master/TableCFsUpdater.java     | 35 ++++++++++++++++++--
 1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/12eec5bc/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/TableCFsUpdater.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/TableCFsUpdater.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/TableCFsUpdater.java
index acd5e1e..cf3705b 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/TableCFsUpdater.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/TableCFsUpdater.java
@@ -22,6 +22,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
 import org.apache.hadoop.hbase.client.replication.ReplicationSerDeHelper;
@@ -37,8 +38,8 @@ import java.io.IOException;
 import java.util.List;
 
 /**
- * This class is used to upgrade TableCFs from HBase 1.x to HBase 2.x.
- * It will be removed in HBase 3.x.  See HBASE-11393
+ * This class is used to upgrade TableCFs from HBase 1.0, 1.1, 1.2, 1.3 to 
HBase 1.4 or 2.x.
+ * It will be removed in HBase 3.x. See HBASE-11393
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
@@ -56,7 +57,7 @@ public class TableCFsUpdater extends ReplicationStateZKBase {
     try {
       znodes = ZKUtil.listChildrenNoWatch(this.zookeeper, this.peersZNode);
     } catch (KeeperException e) {
-      LOG.warn("", e);
+      LOG.error("Failed to get peers znode", e);
     }
     if (znodes != null) {
       for (String peerId : znodes) {
@@ -119,4 +120,32 @@ public class TableCFsUpdater extends 
ReplicationStateZKBase {
     }
   }
 
+  private static void printUsageAndExit() {
+    System.err.printf("Usage: bin/hbase 
org.apache.hadoop.hbase.replication.master.TableCFsUpdater [options]");
+    System.err.println(" where [options] are:");
+    System.err.println("  -h|-help    Show this help and exit.");
+    System.err.println("  update      Copy table-cfs to replication peer 
config");
+    System.err.println();
+    System.exit(1);
+  }
+
+  public static void main(String[] args) throws Exception {
+    if (args.length != 1) {
+      printUsageAndExit();
+    }
+    if (args[0].equals("-help") || args[0].equals("-h")) {
+      printUsageAndExit();
+    } else if (args[0].equals("update")) {
+      Configuration conf = HBaseConfiguration.create();
+      ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf, "TableCFsUpdater", 
null);
+      try {
+        TableCFsUpdater tableCFsUpdater = new TableCFsUpdater(zkw, conf, null);
+        tableCFsUpdater.update();
+      } finally {
+        zkw.close();
+      }
+    } else {
+      printUsageAndExit();
+    }
+  }
 }

Reply via email to