Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1797,14 +1797,20 @@ public void getUserPermissions(RpcController controller,
}
}

// Copied from org.apache.hadoop.hbase.security.access.SecureTestUtil because it's not visible
// there
// Based on org.apache.hadoop.hbase.security.access.SecureTestUtil, which is not visible here.
private static List<AccessController> getAccessControllers(MiniHBaseCluster cluster) {
List<AccessController> result = Lists.newArrayList();
// The master checks grant, revoke and DDL requests against its own permission cache.
// Thus the wait must also include the master.
// The lookup uses the class type. Thus it also finds subclasses of AccessController.
AccessController masterAc =
cluster.getMaster().getMasterCoprocessorHost().findCoprocessor(AccessController.class);
if (masterAc != null) {
result.add(masterAc);
}
for (RegionServerThread t : cluster.getLiveRegionServerThreads()) {
for (HRegion region : t.getRegionServer().getOnlineRegionsLocalContext()) {
Coprocessor cp =
region.getCoprocessorHost().findCoprocessor(AccessController.class.getName());
Coprocessor cp = region.getCoprocessorHost().findCoprocessor(AccessController.class);
if (cp != null) {
result.add((AccessController) cp);
}
Expand All @@ -1813,6 +1819,13 @@ private static List<AccessController> getAccessControllers(MiniHBaseCluster clus
return result;
}

// Identify the controller in log messages. The master controller has no region.
private static String describe(AccessController ac) {
return ac.getRegion() == null
? "master"
: "region " + ac.getRegion().getRegionInfo().getRegionNameAsString();
}

// Copied from org.apache.hadoop.hbase.security.access.SecureTestUtil because it's not visible
// there
private static Map<AccessController, Long> getAuthManagerMTimes(MiniHBaseCluster cluster) {
Expand Down Expand Up @@ -1840,17 +1853,16 @@ public boolean evaluate() {
Map<AccessController, Long> mtimes = getAuthManagerMTimes(util.getHBaseCluster());
for (Map.Entry<AccessController, Long> e : mtimes.entrySet()) {
if (!oldMTimes.containsKey(e.getKey())) {
LOGGER.error("Snapshot of AccessController state does not include instance on region "
+ e.getKey().getRegion().getRegionInfo().getRegionNameAsString());
LOGGER.error("Snapshot of AccessController state does not include instance on "
+ describe(e.getKey()));
// Error out the predicate, we will try again
return false;
}
long old = oldMTimes.get(e.getKey());
long now = e.getValue();
if (now <= old) {
LOGGER.info("AccessController on region "
+ e.getKey().getRegion().getRegionInfo().getRegionNameAsString()
+ " has not updated: mtime=" + now);
LOGGER.info(
"AccessController on " + describe(e.getKey()) + " has not updated: mtime=" + now);
return false;
}
}
Expand Down
Loading