Skip to content

Commit

Permalink
HBASE-24211: Create table is slow in large cluster when AccessControl…
Browse files Browse the repository at this point in the history
…ler is enabled. (#1546)

Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Pankaj <pankajkumar@apache.org>
  • Loading branch information
Mohammad Arshad authored and virajjasani committed Apr 25, 2020
1 parent e0db859 commit 1d1f481
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,28 @@ public void run() {
public void nodeChildrenChanged(final String path) {
waitUntilStarted();
if (path.equals(aclZNode)) {
try {
final List<ZKUtil.NodeAndData> nodeList =
ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
// preempt any existing nodeChildrenChanged event processing
if (childrenChangedFuture != null && !childrenChangedFuture.isDone()) {
boolean cancelled = childrenChangedFuture.cancel(true);
if (!cancelled) {
// task may have finished between our check and attempted cancel, this is fine.
if (! childrenChangedFuture.isDone()) {
LOG.warn("Could not cancel processing node children changed event, " +
"please file a JIRA and attach logs if possible.");
}
// preempt any existing nodeChildrenChanged event processing
if (childrenChangedFuture != null && !childrenChangedFuture.isDone()) {
boolean cancelled = childrenChangedFuture.cancel(true);
if (!cancelled) {
// task may have finished between our check and attempted cancel, this is fine.
if (!childrenChangedFuture.isDone()) {
LOG.warn("Could not cancel processing node children changed event, "
+ "please file a JIRA and attach logs if possible.");
}
}
childrenChangedFuture = asyncProcessNodeUpdate(() -> refreshNodes(nodeList));
} catch (KeeperException ke) {
LOG.error("Error reading data from zookeeper for path "+path, ke);
watcher.abort("ZooKeeper error get node children for path "+path, ke);
}
childrenChangedFuture = asyncProcessNodeUpdate(() -> {
try {
final List<ZKUtil.NodeAndData> nodeList =
ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
refreshNodes(nodeList);
} catch (KeeperException ke) {
String msg = "ZooKeeper error while reading node children data for path " + path;
LOG.error(msg, ke);
watcher.abort(msg, ke);
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ public static List<NodeAndData> getChildDataAndWatchForNewChildren(
if (nodes != null) {
List<NodeAndData> newNodes = new ArrayList<>();
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);
byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath);
newNodes.add(new NodeAndData(nodePath, data));
Expand Down

0 comments on commit 1d1f481

Please sign in to comment.