You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/05/14 03:21:09 UTC
hbase git commit: HBASE-13084 Add labels to VisibilityLabelsCache
asynchronously causes TestShell flakey
Repository: hbase
Updated Branches:
refs/heads/0.98 2c02724c7 -> 2810ba63a
HBASE-13084 Add labels to VisibilityLabelsCache asynchronously causes TestShell flakey
Signed-off-by: stack <st...@apache.org>
Conflicts:
hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2810ba63
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2810ba63
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2810ba63
Branch: refs/heads/0.98
Commit: 2810ba63a9a2e7d285989da9db57c765401334bf
Parents: 2c02724
Author: zhangduo <zh...@wandoujia.com>
Authored: Tue Feb 24 18:18:35 2015 +0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Wed May 13 18:00:37 2015 -0700
----------------------------------------------------------------------
.../hadoop/hbase/HBaseTestingUtility.java | 23 +++++++++++++++++++-
.../ruby/hbase/visibility_labels_admin_test.rb | 2 ++
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/2810ba63/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 6b02205..254eb5a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -85,6 +85,7 @@ import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import org.apache.hadoop.hbase.regionserver.wal.HLog;
import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache;
import org.apache.hadoop.hbase.tool.Canary;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.FSTableDescriptors;
@@ -3506,6 +3507,27 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
}
/**
+ * Wait until labels is ready in VisibilityLabelsCache.
+ * @param timeoutMillis
+ * @param labels
+ */
+ public void waitLabelAvailable(long timeoutMillis, final String... labels) {
+ final VisibilityLabelsCache labelsCache = VisibilityLabelsCache.get();
+ waitFor(timeoutMillis, new Waiter.Predicate<RuntimeException>() {
+
+ @Override
+ public boolean evaluate() {
+ for (String label : labels) {
+ if (labelsCache.getLabelOrdinal(label) == 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
* Create a set of column descriptors with the combination of compression,
* encoding, bloom codecs available.
* @return the list of column descriptors
@@ -3557,5 +3579,4 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
}
return supportedAlgos.toArray(new Algorithm[supportedAlgos.size()]);
}
-
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/2810ba63/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb
index 2c20a17..05c3daf 100644
--- a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb
@@ -49,6 +49,7 @@ module Hbase
label = 'TEST_AUTHS'
user = org.apache.hadoop.hbase.security.User.getCurrent().getName();
visibility_admin.add_labels(label)
+ $TEST_CLUSTER.waitLabelAvailable(10000, label)
count = visibility_admin.get_auths(user).length
# verifying the set functionality
@@ -69,6 +70,7 @@ module Hbase
label = 'TEST_VISIBILITY'
user = org.apache.hadoop.hbase.security.User.getCurrent().getName();
visibility_admin.add_labels(label)
+ $TEST_CLUSTER.waitLabelAvailable(10000, label)
visibility_admin.set_auths(user, label)
# verifying put functionality