HBASE-14209 TestShell visibility tests failing
This commit is contained in:
parent
0c63d415d9
commit
beb1f1d358
|
@ -206,27 +206,37 @@ public class VisibilityLabelsCache implements VisibilityLabelOrdinalProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUserAuths(String user) {
|
public List<String> getUserAuths(String user) {
|
||||||
List<String> auths = EMPTY_LIST;
|
this.lock.readLock().lock();
|
||||||
Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
|
try {
|
||||||
if (!authOrdinals.equals(EMPTY_SET)) {
|
List<String> auths = EMPTY_LIST;
|
||||||
auths = new ArrayList<String>(authOrdinals.size());
|
Set<Integer> authOrdinals = getUserAuthsAsOrdinals(user);
|
||||||
for (Integer authOrdinal : authOrdinals) {
|
if (!authOrdinals.equals(EMPTY_SET)) {
|
||||||
auths.add(ordinalVsLabels.get(authOrdinal));
|
auths = new ArrayList<String>(authOrdinals.size());
|
||||||
|
for (Integer authOrdinal : authOrdinals) {
|
||||||
|
auths.add(ordinalVsLabels.get(authOrdinal));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return auths;
|
||||||
|
} finally {
|
||||||
|
this.lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
return auths;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getGroupAuths(String[] groups) {
|
public List<String> getGroupAuths(String[] groups) {
|
||||||
List<String> auths = EMPTY_LIST;
|
this.lock.readLock().lock();
|
||||||
Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
|
try {
|
||||||
if (!authOrdinals.equals(EMPTY_SET)) {
|
List<String> auths = EMPTY_LIST;
|
||||||
auths = new ArrayList<String>(authOrdinals.size());
|
Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
|
||||||
for (Integer authOrdinal : authOrdinals) {
|
if (!authOrdinals.equals(EMPTY_SET)) {
|
||||||
auths.add(ordinalVsLabels.get(authOrdinal));
|
auths = new ArrayList<String>(authOrdinals.size());
|
||||||
|
for (Integer authOrdinal : authOrdinals) {
|
||||||
|
auths.add(ordinalVsLabels.get(authOrdinal));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return auths;
|
||||||
|
} finally {
|
||||||
|
this.lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
return auths;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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