HBASE-14209 TestShell visibility tests failing
This commit is contained in:
parent
0c63d415d9
commit
beb1f1d358
|
@ -206,6 +206,8 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUserAuths(String user) {
|
public List<String> getUserAuths(String user) {
|
||||||
|
this.lock.readLock().lock();
|
||||||
|
try {
|
||||||
List<String> auths = EMPTY_LIST;
|
List<String> auths = EMPTY_LIST;
|
||||||
Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
|
Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
|
||||||
if (!authOrdinals.equals(EMPTY_SET)) {
|
if (!authOrdinals.equals(EMPTY_SET)) {
|
||||||
|
@ -215,9 +217,14 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return auths;
|
return auths;
|
||||||
|
} finally {
|
||||||
|
this.lock.readLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getGroupAuths(String[] groups) {
|
public List<String> getGroupAuths(String[] groups) {
|
||||||
|
this.lock.readLock().lock();
|
||||||
|
try {
|
||||||
List<String> auths = EMPTY_LIST;
|
List<String> auths = EMPTY_LIST;
|
||||||
Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
|
Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
|
||||||
if (!authOrdinals.equals(EMPTY_SET)) {
|
if (!authOrdinals.equals(EMPTY_SET)) {
|
||||||
|
@ -227,6 +234,9 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return auths;
|
return auths;
|
||||||
|
} finally {
|
||||||
|
this.lock.readLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -270,7 +280,15 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToZookeeper(byte[] data, boolean labelsOrUserAuths) {
|
public void writeToZookeeper(byte[] data, boolean labelsOrUserAuths) throws IOException {
|
||||||
|
// Update local state, then send it to zookeeper
|
||||||
|
if (labelsOrUserAuths) {
|
||||||
|
// True for labels
|
||||||
|
this.refreshLabelsCache(data);
|
||||||
|
} else {
|
||||||
|
// False for user auths
|
||||||
|
this.refreshUserAuthsCache(data);
|
||||||
|
}
|
||||||
this.zkVisibilityWatcher.writeToZookeeper(data, labelsOrUserAuths);
|
this.zkVisibilityWatcher.writeToZookeeper(data, labelsOrUserAuths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue