hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/6] hbase git commit: HBASE-14209 TestShell visibility tests failing
Date Wed, 12 Aug 2015 20:25:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 ae3a1b905 -> cddb28ef9
  refs/heads/branch-1 881d2c1d7 -> ba328d26e
  refs/heads/branch-1.0 d38104c4e -> b99b56715
  refs/heads/branch-1.1 eedde4ad9 -> aa6460539
  refs/heads/branch-1.2 25bf721b5 -> 7fc0b814d
  refs/heads/master 0c63d415d -> beb1f1d35


HBASE-14209 TestShell visibility tests failing


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

Branch: refs/heads/0.98
Commit: cddb28ef9fae67087280b99c4323945e43fba000
Parents: ae3a1b9
Author: Andrew Purtell <apurtell@apache.org>
Authored: Wed Aug 12 13:25:25 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Aug 12 13:25:25 2015 -0700

----------------------------------------------------------------------
 .../visibility/VisibilityLabelsCache.java       | 48 ++++++++++++++------
 1 file changed, 33 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/cddb28ef/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelsCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelsCache.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelsCache.java
index 4cf39c7..763a624 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelsCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityLabelsCache.java
@@ -206,27 +206,37 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider
{
   }
 
   public List<String> getUserAuths(String user) {
-    List<String> auths = EMPTY_LIST;
-    Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
-    if (!authOrdinals.equals(EMPTY_SET)) {
-      auths = new ArrayList<String>(authOrdinals.size());
-      for (Integer authOrdinal : authOrdinals) {
-        auths.add(ordinalVsLabels.get(authOrdinal));
+    this.lock.readLock().lock();
+    try {
+      List<String> auths = EMPTY_LIST;
+      Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
+      if (!authOrdinals.equals(EMPTY_SET)) {
+        auths = new ArrayList<String>(authOrdinals.size());
+        for (Integer authOrdinal : authOrdinals) {
+          auths.add(ordinalVsLabels.get(authOrdinal));
+        }
       }
+      return auths;
+    } finally {
+      this.lock.readLock().unlock();
     }
-    return auths;
   }
 
   public List<String> getGroupAuths(String[] groups) {
-    List<String> auths = EMPTY_LIST;
-    Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
-    if (!authOrdinals.equals(EMPTY_SET)) {
-      auths = new ArrayList<String>(authOrdinals.size());
-      for (Integer authOrdinal : authOrdinals) {
-        auths.add(ordinalVsLabels.get(authOrdinal));
+    this.lock.readLock().lock();
+    try {
+      List<String> auths = EMPTY_LIST;
+      Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
+      if (!authOrdinals.equals(EMPTY_SET)) {
+        auths = new ArrayList<String>(authOrdinals.size());
+        for (Integer authOrdinal : authOrdinals) {
+          auths.add(ordinalVsLabels.get(authOrdinal));
+        }
       }
+      return auths;
+    } finally {
+      this.lock.readLock().unlock();
     }
-    return auths;
   }
 
   /**
@@ -270,7 +280,15 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider
{
     }
   }
 
-  public void writeToZookeeper(byte[] data, boolean labelsOrUserAuths) {
+  public void writeToZookeeper(byte[] data, boolean labelsOrUserAuths) throws IOException
{
+    // Update local state, then send it to zookeeper
+    if (labelsOrUserAuths) {
+      // True for labels
+      this.refreshLabelsCache(data);
+    } else {
+      // False for user auths
+      this.refreshUserAuthsCache(data);
+    }
     this.zkVisibilityWatcher.writeToZookeeper(data, labelsOrUserAuths);
   }
 }


Mime
View raw message