HBASE-24211: Create table is slow in large cluster when AccessController is enabled. (#1577)
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: Pankaj <pankajkumar@apache.org>
This commit is contained in:
parent
a7a4f61040
commit
9fc8263ca4
|
@ -29,6 +29,7 @@ import java.net.Socket;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -801,6 +802,10 @@ public class ZKUtil {
|
||||||
if (nodes != null) {
|
if (nodes != null) {
|
||||||
List<NodeAndData> newNodes = new ArrayList<NodeAndData>();
|
List<NodeAndData> newNodes = new ArrayList<NodeAndData>();
|
||||||
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 = ZKUtil.joinZNode(baseNode, node);
|
String nodePath = ZKUtil.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));
|
||||||
|
|
|
@ -184,30 +184,32 @@ public class ZKPermissionWatcher extends ZooKeeperListener 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(new Runnable() {
|
childrenChangedFuture = asyncProcessNodeUpdate(new Runnable() {
|
||||||
@Override
|
@Override public void run() {
|
||||||
public void run() {
|
try {
|
||||||
|
final List<ZKUtil.NodeAndData> nodeList =
|
||||||
|
ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
|
||||||
refreshNodes(nodeList);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue