hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [3/3] hive git commit: HIVE-11300 HBase metastore: Support token and master key methods (gates)
Date Wed, 22 Jul 2015 18:58:19 GMT
HIVE-11300 HBase metastore: Support token and master key methods (gates)


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

Branch: refs/heads/hbase-metastore
Commit: a310524c48f54cb3071395e11fd97538816261d8
Parents: c53c6f4
Author: Alan Gates <gates@hortonworks.com>
Authored: Wed Jul 22 11:57:32 2015 -0700
Committer: Alan Gates <gates@hortonworks.com>
Committed: Wed Jul 22 11:57:32 2015 -0700

----------------------------------------------------------------------
 .../hbase/TestHBaseStoreIntegration.java        |   44 +
 .../metastore/hbase/HbaseMetastoreProto.java    | 3754 +++++++++++-------
 .../hive/metastore/hbase/HBaseReadWrite.java    |  221 +-
 .../hadoop/hive/metastore/hbase/HBaseStore.java |  101 +-
 .../hadoop/hive/metastore/hbase/HBaseUtils.java |  111 +-
 .../metastore/hbase/hbase_metastore_proto.proto |   13 +-
 .../hive/metastore/hbase/TestHBaseStore.java    |   51 -
 7 files changed, 2769 insertions(+), 1526 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/a310524c/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/TestHBaseStoreIntegration.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/TestHBaseStoreIntegration.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/TestHBaseStoreIntegration.java
index 4ff01a4..8b0b431 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/TestHBaseStoreIntegration.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/hbase/TestHBaseStoreIntegration.java
@@ -1747,4 +1747,48 @@ public class TestHBaseStoreIntegration extends HBaseIntegrationTests
{
           statsList.get(i).getStatsObj().get(1).getStatsData().getStringStats().getNumDVs());
     }
   }
+
+  @Test
+  public void delegationToken() throws Exception {
+    store.addToken("abc", "def");
+    store.addToken("ghi", "jkl");
+
+    Assert.assertEquals("def", store.getToken("abc"));
+    Assert.assertEquals("jkl", store.getToken("ghi"));
+    Assert.assertNull(store.getToken("wabawaba"));
+    String[] allToks = store.getAllTokenIdentifiers().toArray(new String[2]);
+    Arrays.sort(allToks);
+    Assert.assertArrayEquals(new String[]{"abc", "ghi"}, allToks);
+
+    store.removeToken("abc");
+    store.removeToken("wabawaba");
+
+    Assert.assertNull(store.getToken("abc"));
+    Assert.assertEquals("jkl", store.getToken("ghi"));
+    allToks = store.getAllTokenIdentifiers().toArray(new String[1]);
+    Assert.assertArrayEquals(new String[]{"ghi"}, allToks);
+  }
+
+  @Test
+  public void masterKey() throws Exception {
+    Assert.assertEquals(0, store.addMasterKey("k1"));
+    Assert.assertEquals(1, store.addMasterKey("k2"));
+
+    String[] keys = store.getMasterKeys();
+    Arrays.sort(keys);
+    Assert.assertArrayEquals(new String[]{"k1", "k2"}, keys);
+
+    store.updateMasterKey(0, "k3");
+    keys = store.getMasterKeys();
+    Arrays.sort(keys);
+    Assert.assertArrayEquals(new String[]{"k2", "k3"}, keys);
+
+    store.removeMasterKey(1);
+    keys = store.getMasterKeys();
+    Assert.assertArrayEquals(new String[]{"k3"}, keys);
+
+    thrown.expect(NoSuchObjectException.class);
+    store.updateMasterKey(72, "whatever");
+  }
+
 }


Mime
View raw message