本文整理了Java中org.apache.accumulo.fate.zookeeper.ZooReaderWriter.recursiveDelete()
方法的一些代码示例,展示了ZooReaderWriter.recursiveDelete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooReaderWriter.recursiveDelete()
方法的具体详情如下:
包路径:org.apache.accumulo.fate.zookeeper.ZooReaderWriter
类名称:ZooReaderWriter
方法名:recursiveDelete
暂无
代码示例来源:origin: apache/accumulo
public void removeNamespace(Namespace.ID namespaceId)
throws KeeperException, InterruptedException {
zoo.recursiveDelete(zkRoot + Constants.ZNAMESPACES + "/" + namespaceId, NodeMissingPolicy.SKIP);
}
代码示例来源:origin: apache/accumulo
public void removeTable(Table.ID tableId) throws KeeperException, InterruptedException {
synchronized (tableStateCache) {
tableStateCache.remove(tableId);
zoo.recursiveDelete(zkRoot + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE,
NodeMissingPolicy.SKIP);
zoo.recursiveDelete(zkRoot + Constants.ZTABLES + "/" + tableId, NodeMissingPolicy.SKIP);
}
}
代码示例来源:origin: apache/accumulo
public void delete(String server) {
try {
zoo.recursiveDelete(path + "/" + server, NodeMissingPolicy.SKIP);
} catch (Exception ex) {
log.error("delete failed with exception", ex);
}
}
代码示例来源:origin: apache/accumulo
void removeFromZooKeeper(ZooReaderWriter zoorw, ServerContext context)
throws IOException, KeeperException, InterruptedException {
String zpath = getZPath(context.getZooKeeperRoot());
zoorw.recursiveDelete(zpath, NodeMissingPolicy.SKIP);
}
代码示例来源:origin: apache/accumulo
public void forget(TServerInstance instance) throws WalMarkerException {
String path = root() + "/" + instance;
try {
zoo.recursiveDelete(path, NodeMissingPolicy.FAIL);
} catch (InterruptedException | KeeperException e) {
throw new WalMarkerException(e);
}
}
代码示例来源:origin: apache/accumulo
public static void removeNamespaceProperty(ServerContext context, Namespace.ID namespaceId,
String property) throws InterruptedException, KeeperException {
String zPath = getPath(context, namespaceId) + "/" + property;
context.getZooReaderWriter().recursiveDelete(zPath, NodeMissingPolicy.SKIP);
}
代码示例来源:origin: apache/accumulo
public static void removeSystemProperty(ServerContext context, String property)
throws InterruptedException, KeeperException {
String zPath = context.getZooKeeperRoot() + Constants.ZCONFIG + "/" + property;
context.getZooReaderWriter().recursiveDelete(zPath, NodeMissingPolicy.FAIL);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void cleanUser(String user) throws AccumuloSecurityException {
try {
synchronized (zooCache) {
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserSysPerms, NodeMissingPolicy.SKIP);
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms, NodeMissingPolicy.SKIP);
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserNamespacePerms, NodeMissingPolicy.SKIP);
zooCache.clear(ZKUserPath + "/" + user);
}
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
if (e.code().equals(KeeperException.Code.NONODE))
throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
}
}
代码示例来源:origin: apache/accumulo
public void clearMergeState(Table.ID tableId) throws KeeperException, InterruptedException {
synchronized (mergeLock) {
String path = getZooKeeperRoot() + Constants.ZTABLES + "/" + tableId + "/merge";
context.getZooReaderWriter().recursiveDelete(path, NodeMissingPolicy.SKIP);
mergeLock.notifyAll();
}
nextEvent.event("Merge state of %s cleared", tableId);
}
代码示例来源:origin: apache/accumulo
@Override
public void cleanTablePermissions(String table) throws AccumuloSecurityException {
try {
synchronized (zooCache) {
zooCache.clear();
for (String user : zooCache.getChildren(ZKUserPath))
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
NodeMissingPolicy.SKIP);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void cleanNamespacePermissions(String namespace) throws AccumuloSecurityException {
try {
synchronized (zooCache) {
zooCache.clear();
for (String user : zooCache.getChildren(ZKUserPath))
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
NodeMissingPolicy.SKIP);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException("unknownUser", SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/accumulo
zoo.recursiveDelete(childPath, NodeMissingPolicy.SKIP);
} catch (Exception e) {
log.error("Error received when trying to delete entry in zookeeper " + childPath,
zoo.recursiveDelete(lockPath, NodeMissingPolicy.SKIP);
} catch (Exception e) {
log.error("Error received when trying to delete entry in zookeeper " + childPath,
代码示例来源:origin: apache/accumulo
public void cloneTable(Table.ID srcTableId, Table.ID tableId, String tableName,
Namespace.ID namespaceId, Map<String,String> propertiesToSet, Set<String> propertiesToExclude,
NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException {
prepareNewTableState(zoo, instanceID, tableId, namespaceId, tableName, TableState.NEW,
existsPolicy);
String srcTablePath = Constants.ZROOT + "/" + instanceID + Constants.ZTABLES + "/" + srcTableId
+ Constants.ZTABLE_CONF;
String newTablePath = Constants.ZROOT + "/" + instanceID + Constants.ZTABLES + "/" + tableId
+ Constants.ZTABLE_CONF;
zoo.recursiveCopyPersistent(srcTablePath, newTablePath, NodeExistsPolicy.OVERWRITE);
for (Entry<String,String> entry : propertiesToSet.entrySet())
TablePropUtil.setTableProperty(context, tableId, entry.getKey(), entry.getValue());
for (String prop : propertiesToExclude)
zoo.recursiveDelete(Constants.ZROOT + "/" + instanceID + Constants.ZTABLES + "/" + tableId
+ Constants.ZTABLE_CONF + "/" + prop, NodeMissingPolicy.SKIP);
updateTableStateCache(tableId);
}
代码示例来源:origin: apache/accumulo
public static void removeTableProperty(ServerContext context, Table.ID tableId, String property)
throws InterruptedException, KeeperException {
String zPath = getTablePath(context.getZooKeeperRoot(), tableId) + "/" + property;
context.getZooReaderWriter().recursiveDelete(zPath, NodeMissingPolicy.SKIP);
}
代码示例来源:origin: apache/accumulo
public synchronized void remove(TServerInstance server) {
String zPath = null;
for (Entry<String,TServerInfo> entry : current.entrySet()) {
if (entry.getValue().instance.equals(server)) {
zPath = entry.getKey();
break;
}
}
if (zPath == null)
return;
current.remove(zPath);
currentInstances.remove(server);
log.info("Removing zookeeper lock for {}", server);
String fullpath = context.getZooKeeperRoot() + Constants.ZTSERVERS + "/" + zPath;
try {
context.getZooReaderWriter().recursiveDelete(fullpath, SKIP);
} catch (Exception e) {
String msg = "error removing tablet server lock";
// ACCUMULO-3651 Changed level to error and added FATAL to message for slf4j compatibility
log.error("FATAL: {}", msg, e);
Halt.halt(msg, -1);
}
getZooCache().clear(fullpath);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void revokeTablePermission(String user, String table, TablePermission permission)
throws AccumuloSecurityException {
byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
// User had no table permission, nothing to revoke.
if (serializedPerms == null)
return;
Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
try {
if (tablePerms.remove(permission)) {
zooCache.clear();
if (tablePerms.size() == 0)
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
NodeMissingPolicy.SKIP);
else
zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
ZKSecurityTool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void dropUser(String user) throws AccumuloSecurityException {
try {
synchronized (zooCache) {
zooCache.clear();
context.getZooReaderWriter().recursiveDelete(ZKUserPath + "/" + user,
NodeMissingPolicy.FAIL);
}
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (KeeperException e) {
if (e.code().equals(KeeperException.Code.NONODE)) {
throw new AccumuloSecurityException(user, SecurityErrorCode.USER_DOESNT_EXIST, e);
}
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void revokeNamespacePermission(String user, String namespace,
NamespacePermission permission) throws AccumuloSecurityException {
byte[] serializedPerms = zooCache
.get(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace);
// User had no namespace permission, nothing to revoke.
if (serializedPerms == null)
return;
Set<NamespacePermission> namespacePerms = ZKSecurityTool
.convertNamespacePermissions(serializedPerms);
try {
if (namespacePerms.remove(permission)) {
zooCache.clear();
if (namespacePerms.size() == 0)
zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
NodeMissingPolicy.SKIP);
else
zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserNamespacePerms + "/" + namespace,
ZKSecurityTool.convertNamespacePermissions(namespacePerms),
NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/accumulo
public void setMergeState(MergeInfo info, MergeState state)
throws KeeperException, InterruptedException {
synchronized (mergeLock) {
String path = getZooKeeperRoot() + Constants.ZTABLES + "/" + info.getExtent().getTableId()
+ "/merge";
info.setState(state);
if (state.equals(MergeState.NONE)) {
context.getZooReaderWriter().recursiveDelete(path, NodeMissingPolicy.SKIP);
} else {
DataOutputBuffer out = new DataOutputBuffer();
try {
info.write(out);
} catch (IOException ex) {
throw new RuntimeException("Unlikely", ex);
}
context.getZooReaderWriter().putPersistentData(path, out.getData(),
state.equals(MergeState.STARTED) ? ZooUtil.NodeExistsPolicy.FAIL
: ZooUtil.NodeExistsPolicy.OVERWRITE);
}
mergeLock.notifyAll();
}
nextEvent.event("Merge state of %s set to %s", info.getExtent(), state);
}
代码示例来源:origin: apache/accumulo
orig.recursiveDelete(path, NodeMissingPolicy.SKIP);
new_.putPersistentData(path, newInstanceId.getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
内容来源于网络,如有侵权,请联系作者删除!