HDDS-1686. Remove check to get from openKeyTable in acl implementatio… (#966)
This commit is contained in:
parent
c958eddcf4
commit
2ea71d953b
@ -1396,17 +1396,10 @@ public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
|
||||
validateBucket(volume, bucket);
|
||||
String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName);
|
||||
OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey);
|
||||
Table keyTable;
|
||||
if (keyInfo == null) {
|
||||
keyInfo = metadataManager.getOpenKeyTable().get(objectKey);
|
||||
if (keyInfo == null) {
|
||||
throw new OMException("Key not found. Key:" +
|
||||
objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
keyTable = metadataManager.getOpenKeyTable();
|
||||
} else {
|
||||
keyTable = metadataManager.getKeyTable();
|
||||
throw new OMException("Key not found. Key:" + objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
List<OzoneAclInfo> newAcls = new ArrayList<>(keyInfo.getAcls());
|
||||
OzoneAclInfo newAcl = null;
|
||||
for(OzoneAclInfo a: keyInfo.getAcls()) {
|
||||
@ -1442,7 +1435,7 @@ public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
|
||||
.setDataSize(keyInfo.getDataSize())
|
||||
.setFileEncryptionInfo(keyInfo.getFileEncryptionInfo())
|
||||
.build();
|
||||
keyTable.put(objectKey, newObj);
|
||||
metadataManager.getKeyTable().put(objectKey, newObj);
|
||||
} catch (IOException ex) {
|
||||
if (!(ex instanceof OMException)) {
|
||||
LOG.error("Add acl operation failed for key:{}/{}/{}", volume,
|
||||
@ -1475,16 +1468,8 @@ public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
|
||||
validateBucket(volume, bucket);
|
||||
String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName);
|
||||
OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey);
|
||||
Table keyTable;
|
||||
if (keyInfo == null) {
|
||||
keyInfo = metadataManager.getOpenKeyTable().get(objectKey);
|
||||
if (keyInfo == null) {
|
||||
throw new OMException("Key not found. Key:" +
|
||||
objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
keyTable = metadataManager.getOpenKeyTable();
|
||||
} else {
|
||||
keyTable = metadataManager.getKeyTable();
|
||||
throw new OMException("Key not found. Key:" + objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
List<OzoneAclInfo> newAcls = new ArrayList<>(keyInfo.getAcls());
|
||||
@ -1529,7 +1514,7 @@ public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
|
||||
.setFileEncryptionInfo(keyInfo.getFileEncryptionInfo())
|
||||
.build();
|
||||
|
||||
keyTable.put(objectKey, newObj);
|
||||
metadataManager.getKeyTable().put(objectKey, newObj);
|
||||
} catch (IOException ex) {
|
||||
if (!(ex instanceof OMException)) {
|
||||
LOG.error("Remove acl operation failed for key:{}/{}/{}", volume,
|
||||
@ -1562,16 +1547,8 @@ public boolean setAcl(OzoneObj obj, List<OzoneAcl> acls) throws IOException {
|
||||
validateBucket(volume, bucket);
|
||||
String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName);
|
||||
OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey);
|
||||
Table keyTable;
|
||||
if (keyInfo == null) {
|
||||
keyInfo = metadataManager.getOpenKeyTable().get(objectKey);
|
||||
if (keyInfo == null) {
|
||||
throw new OMException("Key not found. Key:" +
|
||||
objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
keyTable = metadataManager.getOpenKeyTable();
|
||||
} else {
|
||||
keyTable = metadataManager.getKeyTable();
|
||||
throw new OMException("Key not found. Key:" + objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
List<OzoneAclInfo> newAcls = new ArrayList<>();
|
||||
@ -1592,7 +1569,7 @@ public boolean setAcl(OzoneObj obj, List<OzoneAcl> acls) throws IOException {
|
||||
.setFileEncryptionInfo(keyInfo.getFileEncryptionInfo())
|
||||
.build();
|
||||
|
||||
keyTable.put(objectKey, newObj);
|
||||
metadataManager.getKeyTable().put(objectKey, newObj);
|
||||
} catch (IOException ex) {
|
||||
if (!(ex instanceof OMException)) {
|
||||
LOG.error("Set acl operation failed for key:{}/{}/{}", volume,
|
||||
@ -1624,11 +1601,7 @@ public List<OzoneAcl> getAcl(OzoneObj obj) throws IOException {
|
||||
String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName);
|
||||
OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey);
|
||||
if (keyInfo == null) {
|
||||
keyInfo = metadataManager.getOpenKeyTable().get(objectKey);
|
||||
if (keyInfo == null) {
|
||||
throw new OMException("Key not found. Key:" +
|
||||
objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
throw new OMException("Key not found. Key:" + objectKey, KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
List<OzoneAcl> acls = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user