hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-13084 Add labels to VisibilityLabelsCache asynchronously causes TestShell flakey
Date Wed, 25 Feb 2015 01:06:49 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 514dd5842 -> a2123144f


HBASE-13084 Add labels to VisibilityLabelsCache asynchronously causes TestShell flakey

Signed-off-by: stack <stack@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/a2123144
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a2123144
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a2123144

Branch: refs/heads/branch-1
Commit: a2123144ff51cbb3e6656065b72917d8bcc69364
Parents: 514dd58
Author: zhangduo <zhangduo@wandoujia.com>
Authored: Tue Feb 24 18:18:35 2015 +0800
Committer: stack <stack@apache.org>
Committed: Tue Feb 24 17:06:34 2015 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/HBaseTestingUtility.java       | 51 ++++++++++++++++----
 .../ruby/hbase/visibility_labels_admin_test.rb  |  2 +
 2 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a2123144/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 1b2406a..67aa530 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
@@ -91,6 +91,7 @@ import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException;
 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;
@@ -3798,6 +3799,47 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility
{
   }
 
   /**
+   * Wait until no regions in transition.
+   * @param timeout How long to wait.
+   * @throws Exception
+   */
+  public void waitUntilNoRegionsInTransition(
+      final long timeout) throws Exception {
+    waitFor(timeout, predicateNoRegionsInTransition());
+  }
+
+  /**
+   * 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.ExplainingPredicate<RuntimeException>() {
+
+      @Override
+      public boolean evaluate() {
+        for (String label : labels) {
+          if (labelsCache.getLabelOrdinal(label) == 0) {
+            return false;
+          }
+        }
+        return true;
+      }
+
+      @Override
+      public String explainFailure() {
+        for (String label : labels) {
+          if (labelsCache.getLabelOrdinal(label) == 0) {
+            return label + " is not available yet";
+          }
+        }
+        return "";
+      }
+    });
+  }
+
+  /**
    * Create a set of column descriptors with the combination of compression,
    * encoding, bloom codecs available.
    * @return the list of column descriptors
@@ -3849,13 +3891,4 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility
{
     }
     return supportedAlgos.toArray(new Algorithm[supportedAlgos.size()]);
   }
-
-  /**
-   * Wait until no regions in transition.
-   * @param timeout How long to wait.
-   * @throws Exception
-   */
-  public void waitUntilNoRegionsInTransition(final long timeout) throws Exception {
-    waitFor(timeout, predicateNoRegionsInTransition());
-  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a2123144/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 0815d83..47ac292 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
@@ -54,6 +54,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
@@ -74,6 +75,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


Mime
View raw message