HBASE-24211: Create table is slow in large cluster when AccessController is enabled. (#1546)
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Pankaj <pankajkumar@apache.org>
This commit is contained in:
parent
a9c1ca9577
commit
e6cc5eb2f0
|
@ -185,25 +185,28 @@ public class ZKPermissionWatcher extends ZKListener implements Closeable {
|
||||||
public void nodeChildrenChanged(final String path) {
|
public void nodeChildrenChanged(final String path) {
|
||||||
waitUntilStarted();
|
waitUntilStarted();
|
||||||
if (path.equals(aclZNode)) {
|
if (path.equals(aclZNode)) {
|
||||||
try {
|
|
||||||
final List<ZKUtil.NodeAndData> nodeList =
|
|
||||||
ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
|
|
||||||
// preempt any existing nodeChildrenChanged event processing
|
// preempt any existing nodeChildrenChanged event processing
|
||||||
if (childrenChangedFuture != null && !childrenChangedFuture.isDone()) {
|
if (childrenChangedFuture != null && !childrenChangedFuture.isDone()) {
|
||||||
boolean cancelled = childrenChangedFuture.cancel(true);
|
boolean cancelled = childrenChangedFuture.cancel(true);
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
// task may have finished between our check and attempted cancel, this is fine.
|
// task may have finished between our check and attempted cancel, this is fine.
|
||||||
if (!childrenChangedFuture.isDone()) {
|
if (!childrenChangedFuture.isDone()) {
|
||||||
LOG.warn("Could not cancel processing node children changed event, " +
|
LOG.warn("Could not cancel processing node children changed event, "
|
||||||
"please file a JIRA and attach logs if possible.");
|
+ "please file a JIRA and attach logs if possible.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
childrenChangedFuture = asyncProcessNodeUpdate(() -> refreshNodes(nodeList));
|
childrenChangedFuture = asyncProcessNodeUpdate(() -> {
|
||||||
|
try {
|
||||||
|
final List<ZKUtil.NodeAndData> nodeList =
|
||||||
|
ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
|
||||||
|
refreshNodes(nodeList);
|
||||||
} catch (KeeperException ke) {
|
} catch (KeeperException ke) {
|
||||||
LOG.error("Error reading data from zookeeper for path "+path, ke);
|
String msg = "ZooKeeper error while reading node children data for path " + path;
|
||||||
watcher.abort("ZooKeeper error get node children for path "+path, ke);
|
LOG.error(msg, ke);
|
||||||
|
watcher.abort(msg, ke);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -742,6 +742,10 @@ public final class ZKUtil {
|
||||||
if (nodes != null) {
|
if (nodes != null) {
|
||||||
List<NodeAndData> newNodes = new ArrayList<>();
|
List<NodeAndData> newNodes = new ArrayList<>();
|
||||||
for (String node : nodes) {
|
for (String node : nodes) {
|
||||||
|
if (Thread.interrupted()) {
|
||||||
|
// Partial data should not be processed. Cancel processing by sending empty list.
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
String nodePath = ZNodePaths.joinZNode(baseNode, node);
|
String nodePath = ZNodePaths.joinZNode(baseNode, node);
|
||||||
byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath);
|
byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath);
|
||||||
newNodes.add(new NodeAndData(nodePath, data));
|
newNodes.add(new NodeAndData(nodePath, data));
|
||||||
|
|
Loading…
Reference in New Issue