Author: enis Date: Wed Jun 19 18:37:26 2013 New Revision: 1494732 URL: http://svn.apache.org/r1494732 Log: HBASE-8766 [WINDOWS] bin/hbase.cmd zkcli is broken
Added: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java - copied, changed from r1494729, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServerArg.java hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java - copied, changed from r1494729, hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServerArg.java Removed: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServerArg.java hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServerArg.java Modified: hbase/trunk/bin/hbase hbase/trunk/bin/hbase.cmd Modified: hbase/trunk/bin/hbase URL: http://svn.apache.org/viewvc/hbase/trunk/bin/hbase?rev=1494732&r1=1494731&r2=1494732&view=diff ============================================================================== --- hbase/trunk/bin/hbase (original) +++ hbase/trunk/bin/hbase Wed Jun 19 18:37:26 2013 @@ -273,10 +273,7 @@ elif [ "$COMMAND" = "hlog" ] ; then elif [ "$COMMAND" = "hfile" ] ; then CLASS='org.apache.hadoop.hbase.io.hfile.HFile' elif [ "$COMMAND" = "zkcli" ] ; then - # ZooKeeperMainServerArg returns '-server HOST:PORT' or empty string. - SERVER_ARG=`"$bin"/hbase org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServerArg` - CLASS="org.apache.zookeeper.ZooKeeperMain ${SERVER_ARG}" - + CLASS="org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServer" elif [ "$COMMAND" = "master" ] ; then CLASS='org.apache.hadoop.hbase.master.HMaster' if [ "$1" != "stop" ] ; then Modified: hbase/trunk/bin/hbase.cmd URL: http://svn.apache.org/viewvc/hbase/trunk/bin/hbase.cmd?rev=1494732&r1=1494731&r2=1494732&view=diff ============================================================================== --- hbase/trunk/bin/hbase.cmd (original) +++ hbase/trunk/bin/hbase.cmd Wed Jun 19 18:37:26 2013 @@ -337,9 +337,7 @@ goto :eof goto :eof :zkcli - rem ZooKeeperMainServerArg returns '-server HOST:PORT' or empty string. - set SERVER_ARG=%HADOOP_BIN_PATH%\hbase org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServerArg - set CLASS=org.apache.zookeeper.ZooKeeperMain %SERVER_ARG% + set CLASS=org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServer goto :eof :makeServiceXml Copied: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java (from r1494729, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServerArg.java) URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java?p2=hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java&p1=hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServerArg.java&r1=1494729&r2=1494732&rev=1494732&view=diff ============================================================================== --- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServerArg.java (original) +++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java Wed Jun 19 18:37:26 2013 @@ -26,15 +26,13 @@ import java.util.Properties; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.zookeeper.ZooKeeperMain; /** - * Tool for reading a ZooKeeper server from HBase XML configuration producing - * the '-server host:port' argument to pass ZooKeeperMain. This program - * emits either '-server HOST:PORT" where HOST is one of the zk ensemble - * members plus zk client port OR it emits '' if no zk servers found (Yes, - * it emits '-server' too). + * Tool for running ZookeeperMain from HBase by reading a ZooKeeper server + * from HBase XML configuration. */ -public class ZooKeeperMainServerArg { +public class ZooKeeperMainServer { public String parse(final Configuration c) { // Note that we do not simply grab the property // HConstants.ZOOKEEPER_QUORUM from the HBaseConfiguration because the @@ -68,10 +66,10 @@ public class ZooKeeperMainServerArg { * Run the tool. * @param args Command line arguments. First arg is path to zookeepers file. */ - public static void main(String args[]) { + public static void main(String args[]) throws Exception { Configuration conf = HBaseConfiguration.create(); - String hostport = new ZooKeeperMainServerArg().parse(conf); - System.out.println((hostport == null || hostport.length() == 0)? "": - "-server " + hostport); + String hostport = new ZooKeeperMainServer().parse(conf); + String zkArg = (hostport == null || hostport.length() == 0)? "": "-server " + hostport; + ZooKeeperMain.main(new String[] {zkArg}); } } Copied: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java (from r1494729, hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServerArg.java) URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java?p2=hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java&p1=hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServerArg.java&r1=1494729&r2=1494732&rev=1494732&view=diff ============================================================================== --- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServerArg.java (original) +++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java Wed Jun 19 18:37:26 2013 @@ -27,8 +27,8 @@ import org.junit.Test; import org.junit.experimental.categories.Category; @Category(SmallTests.class) -public class TestZooKeeperMainServerArg { - private final ZooKeeperMainServerArg parser = new ZooKeeperMainServerArg(); +public class TestZooKeeperMainServer { + private final ZooKeeperMainServer parser = new ZooKeeperMainServer(); @Test public void test() { Configuration c = HBaseConfiguration.create(); @@ -42,6 +42,5 @@ public class TestZooKeeperMainServerArg assertTrue(port, parser.parse(c).matches("(example[1-3]\\.com,){2}example[1-3]\\.com:" + port)); } - }