hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1550633 - in /hbase/branches/0.98/hbase-server/src: main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
Date Fri, 13 Dec 2013 04:23:59 GMT
Author: apurtell
Date: Fri Dec 13 04:23:59 2013
New Revision: 1550633

URL: http://svn.apache.org/r1550633
Log:
HBASE-10149. TestZKPermissionsWatcher.testPermissionsWatcher test failure

Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java
    hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java?rev=1550633&r1=1550632&r2=1550633&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/TableAuthManager.java
Fri Dec 13 04:23:59 2013
@@ -103,6 +103,7 @@ public class TableAuthManager {
 
   private Configuration conf;
   private ZKPermissionWatcher zkperms;
+  private volatile long mtime;
 
   private TableAuthManager(ZooKeeperWatcher watcher, Configuration conf)
       throws IOException {
@@ -209,6 +210,7 @@ public class TableAuthManager {
         }
       }
       globalCache = newCache;
+      mtime++;
     } catch (IOException e) {
       // Never happens
       LOG.error("Error occured while updating the global cache", e);
@@ -236,6 +238,7 @@ public class TableAuthManager {
     }
 
     tableCache.put(table, newTablePerms);
+    mtime++;
   }
 
   /**
@@ -259,6 +262,7 @@ public class TableAuthManager {
     }
 
     nsCache.put(namespace, newTablePerms);
+    mtime++;
   }
 
   private PermissionCache<TablePermission> getTablePermissions(TableName table) {
@@ -678,6 +682,10 @@ public class TableAuthManager {
         serialized);
   }
 
+  public long getMTime() {
+    return mtime;
+  }
+
   static Map<ZooKeeperWatcher,TableAuthManager> managerMap =
     new HashMap<ZooKeeperWatcher,TableAuthManager>();
 

Modified: hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java?rev=1550633&r1=1550632&r2=1550633&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
(original)
+++ hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
Fri Dec 13 04:23:59 2013
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.Abortable
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.Waiter.Predicate;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -108,7 +109,15 @@ public class TestZKPermissionsWatcher {
     List<TablePermission> acl = new ArrayList<TablePermission>();
     acl.add(new TablePermission(TEST_TABLE, null, TablePermission.Action.READ,
       TablePermission.Action.WRITE));
+    final long mtimeB = AUTH_B.getMTime();
     AUTH_A.setTableUserPermissions("george", TEST_TABLE, acl);
+    // Wait for the update to propagate
+    UTIL.waitFor(10000, 100, new Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return AUTH_B.getMTime() > mtimeB;
+      }
+    });
     Thread.sleep(100);
 
     // check it
@@ -132,7 +141,15 @@ public class TestZKPermissionsWatcher {
     // update ACL: hubert R
     acl = new ArrayList<TablePermission>();
     acl.add(new TablePermission(TEST_TABLE, null, TablePermission.Action.READ));
+    final long mtimeA = AUTH_A.getMTime();
     AUTH_B.setTableUserPermissions("hubert", TEST_TABLE, acl);
+    // Wait for the update to propagate
+    UTIL.waitFor(10000, 100, new Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return AUTH_A.getMTime() > mtimeA;
+      }
+    });
     Thread.sleep(100);
 
     // check it



Mime
View raw message