diff --git hbase-handler/ivy.xml hbase-handler/ivy.xml
index 0a8ab23..dee609e 100644
--- hbase-handler/ivy.xml
+++ hbase-handler/ivy.xml
@@ -49,6 +49,8 @@
+
diff --git hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
index a956746..163f676 100644
--- hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
+++ hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
@@ -28,9 +28,9 @@ import junit.framework.Test;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.mapred.JobConf;
import org.apache.zookeeper.Watcher;
@@ -61,7 +61,7 @@ public class HBaseTestSetup extends TestSetup {
setUpFixtures(conf);
}
conf.set("hbase.rootdir", hbaseRoot);
- conf.set("hbase.master", hbaseCluster.getHMasterAddress().toString());
+ conf.set("hbase.master", hbaseCluster.getMaster().getServerName().getHostAndPort());
conf.set("hbase.zookeeper.property.clientPort",
Integer.toString(zooKeeperPort));
String auxJars = conf.getAuxJars();
@@ -88,7 +88,7 @@ public class HBaseTestSetup extends TestSetup {
hbaseConf.setInt("hbase.regionserver.port", findFreePort());
hbaseConf.setInt("hbase.regionserver.info.port", -1);
hbaseCluster = new MiniHBaseCluster(hbaseConf, NUM_REGIONSERVERS);
- conf.set("hbase.master", hbaseCluster.getHMasterAddress().toString());
+ conf.set("hbase.master", hbaseCluster.getMaster().getServerName().getHostAndPort());
// opening the META table ensures that cluster is running
new HTable(new HBaseConfiguration(conf), HConstants.META_TABLE_NAME);
}
diff --git ivy/libraries.properties ivy/libraries.properties
index 7d9eb07..ed171c7 100644
--- ivy/libraries.properties
+++ ivy/libraries.properties
@@ -37,9 +37,8 @@ commons-logging.version=1.0.4
commons-logging-api.version=1.0.4
commons-pool.version=1.5.4
derby.version=10.4.2.0
-guava.version=r06
-hbase.version=0.89.0-SNAPSHOT
-hbase-test.version=0.89.0-SNAPSHOT
+guava.version=r09
+hbase.version=0.92.0
javaewah.version=0.3.2
jdo-api.version=2.3-ec
jdom.version=1.1
@@ -54,5 +53,4 @@ mockito-all.version=1.8.2
slf4j-api.version=1.6.1
slf4j-log4j12.version=1.6.1
velocity.version=1.5
-zookeeper.version=3.3.1
-
+zookeeper.version=3.4.3
diff --git shims/src/common-secure/java/org/apache/hadoop/hive/thrift/DelegationTokenStore.java shims/src/common-secure/java/org/apache/hadoop/hive/thrift/DelegationTokenStore.java
index 2fb9879..038dd99 100644
--- shims/src/common-secure/java/org/apache/hadoop/hive/thrift/DelegationTokenStore.java
+++ shims/src/common-secure/java/org/apache/hadoop/hive/thrift/DelegationTokenStore.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hive.thrift;
+import java.io.Closeable;
import java.util.List;
import org.apache.hadoop.conf.Configurable;
@@ -27,7 +28,7 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecret
* storage for load balancing and high availability (for example using ZooKeeper).
* Internal, store specific errors are translated into {@link TokenStoreException}.
*/
-public interface DelegationTokenStore extends Configurable {
+public interface DelegationTokenStore extends Configurable, Closeable {
/**
* Exception for internal token store errors that typically cannot be handled by the caller.
diff --git shims/src/common-secure/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java shims/src/common-secure/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java
index 8b441df..9abdb38 100644
--- shims/src/common-secure/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java
+++ shims/src/common-secure/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.hive.thrift;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -101,4 +102,9 @@ public class MemoryTokenStore implements DelegationTokenStore {
return result;
}
+ @Override
+ public void close() throws IOException {
+ //no-op
+ }
+
}
diff --git shims/src/common-secure/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java shims/src/common-secure/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java
index 35976ba..81ecceb 100644
--- shims/src/common-secure/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java
+++ shims/src/common-secure/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java
@@ -58,7 +58,6 @@ public class ZooKeeperTokenStore implements DelegationTokenStore {
private final int zkSessionTimeout = 3000;
private List newNodeAcl = Ids.OPEN_ACL_UNSAFE;
-
private class ZooKeeperWatcher implements Watcher {
public void process(org.apache.zookeeper.WatchedEvent event) {
LOGGER.info(event.toString());
@@ -199,8 +198,8 @@ public class ZooKeeperTokenStore implements DelegationTokenStore {
LOGGER.warn("Failed to close existing session.", ex);
}
}
-
ZooKeeper zk = getSession();
+
try {
ensurePath(zk, rootNode + NODE_KEYS, newNodeAcl);
ensurePath(zk, rootNode + NODE_TOKENS, newNodeAcl);
@@ -400,4 +399,15 @@ public class ZooKeeperTokenStore implements DelegationTokenStore {
return result;
}
+ @Override
+ public void close() throws IOException {
+ if (this.zkSession != null) {
+ try {
+ this.zkSession.close();
+ } catch (InterruptedException ex) {
+ LOGGER.warn("Failed to close existing session.", ex);
+ }
+ }
+ }
+
}
diff --git shims/src/test/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java shims/src/test/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java
index 1b10568..29bda65 100644
--- shims/src/test/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java
+++ shims/src/test/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java
@@ -39,6 +39,8 @@ public class TestZooKeeperTokenStore extends TestCase {
private MiniZooKeeperCluster zkCluster = null;
private ZooKeeper zkClient = null;
+ private int zkPort = -1;
+ private ZooKeeperTokenStore ts;
@Override
protected void setUp() throws Exception {
@@ -47,14 +49,17 @@ public class TestZooKeeperTokenStore extends TestCase {
throw new IOException("Cluster already running");
}
this.zkCluster = new MiniZooKeeperCluster();
- this.zkCluster.startup(zkDataDir);
+ this.zkPort = this.zkCluster.startup(zkDataDir);
this.zkClient = new ZooKeeper("localhost:"
- + this.zkCluster.getClientPort(), 300, null);
+ + zkPort, 300, null);
}
@Override
protected void tearDown() throws Exception {
this.zkClient.close();
+ if (ts != null) {
+ ts.close();
+ }
this.zkCluster.shutdown();
this.zkCluster = null;
}
@@ -63,7 +68,7 @@ public class TestZooKeeperTokenStore extends TestCase {
Configuration conf = new Configuration();
conf.set(
HadoopThriftAuthBridge20S.Server.DELEGATION_TOKEN_STORE_ZK_CONNECT_STR,
- "localhost:" + this.zkCluster.getClientPort());
+ "localhost:" + this.zkPort);
conf.set(
HadoopThriftAuthBridge20S.Server.DELEGATION_TOKEN_STORE_ZK_ZNODE,
zkPath);
@@ -72,7 +77,7 @@ public class TestZooKeeperTokenStore extends TestCase {
public void testTokenStorage() throws Exception {
String ZK_PATH = "/zktokenstore-testTokenStorage";
- ZooKeeperTokenStore ts = new ZooKeeperTokenStore();
+ ts = new ZooKeeperTokenStore();
ts.setConf(createConf(ZK_PATH));
int keySeq = ts.addMasterKey("key1Data");
@@ -124,7 +129,7 @@ public class TestZooKeeperTokenStore extends TestCase {
HadoopThriftAuthBridge20S.Server.DELEGATION_TOKEN_STORE_ZK_ACL,
"ip:127.0.0.1:r");
- ZooKeeperTokenStore ts = new ZooKeeperTokenStore();
+ ts = new ZooKeeperTokenStore();
try {
ts.setConf(conf);
fail("expected ACL exception");
@@ -145,7 +150,7 @@ public class TestZooKeeperTokenStore extends TestCase {
List aclList = ZooKeeperTokenStore.parseACLs(aclString);
assertEquals(1, aclList.size());
- ZooKeeperTokenStore ts = new ZooKeeperTokenStore();
+ ts = new ZooKeeperTokenStore();
try {
ts.setConf(conf);
fail("expected ACL exception");
@@ -161,7 +166,7 @@ public class TestZooKeeperTokenStore extends TestCase {
conf.set(
HadoopThriftAuthBridge20S.Server.DELEGATION_TOKEN_STORE_ZK_ACL,
"world:anyone:cdrwa,ip:127.0.0.1:cdrwa");
- ZooKeeperTokenStore ts = new ZooKeeperTokenStore();
+ ts = new ZooKeeperTokenStore();
ts.setConf(conf);
List acl = zkClient.getACL(ZK_PATH, new Stat());
assertEquals(2, acl.size());