You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2016/11/10 22:15:32 UTC
[2/2] hbase git commit: HBASE-16938 TableCFsUpdater maybe failed due
to no write permission on peerNode
HBASE-16938 TableCFsUpdater maybe failed due to no write permission on peerNode
Signed-off-by: Enis Soztutar <en...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a6397e3b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a6397e3b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a6397e3b
Branch: refs/heads/branch-1
Commit: a6397e3b0c5a9c938c0a00cb5d3cd762d498afd1
Parents: dac73ec
Author: Guanghao Zhang <zg...@gmail.com>
Authored: Tue Oct 25 09:50:47 2016 +0800
Committer: Enis Soztutar <en...@apache.org>
Committed: Thu Nov 10 14:07:20 2016 -0800
----------------------------------------------------------------------
.../replication/master/TableCFsUpdater.java | 35 ++++++++++++++++++--
1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/a6397e3b/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 ce07868..b6c4013 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.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) {
@@ -117,4 +118,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();
+ }
+ }
}