@Override public boolean hasSystemPermission(String user, SystemPermission permission) { byte[] perms; try { String path = ZKUserPath + "/" + user + ZKUserSysPerms; zoo.sync(path); perms = zoo.getData(path, null); } catch (KeeperException e) { if (e.code() == Code.NONODE) { return false; } log.warn("Unhandled KeeperException, failing closed for table permission check", e); return false; } catch (InterruptedException e) { log.warn("Unhandled InterruptedException, failing closed for table permission check", e); return false; } if (perms == null) return false; return ZKSecurityTool.convertSystemPermissions(perms).contains(permission); }
try { String path = ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table; zoo.sync(path); serializedPerms = zoo.getData(path, null); } catch (KeeperException e) {
try { String path = ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace; zoo.sync(path); serializedPerms = zoo.getData(path, null); } catch (KeeperException e) {
public List<Path> getWalsInUse(TServerInstance tsi) throws WalMarkerException { List<Path> result = new ArrayList<>(); try { String zpath = root() + "/" + tsi; zoo.sync(zpath); for (String child : zoo.getChildren(zpath)) { byte[] zdata = null; try { // This function is called by the Master. Its possible that Accumulo GC deletes an // unreferenced WAL in ZK after the call to getChildren above. Catch this exception inside // the loop so that not all children are ignored. zdata = zoo.getData(zpath + "/" + child, null); } catch (KeeperException.NoNodeException e) { log.debug("WAL state removed {} {} during getWalsInUse. Likely a race condition between " + "master and GC.", tsi, child); } if (zdata != null) { Pair<WalState,Path> parts = parse(zdata); if (parts.getFirst() != WalState.UNREFERENCED) { result.add(parts.getSecond()); } } } } catch (KeeperException.NoNodeException e) { log.debug("{} has no wal entry in zookeeper, assuming no logs", tsi); } catch (KeeperException | InterruptedException e) { throw new WalMarkerException(e); } return result; }