adoroszlai commented on code in PR #4883:
URL: https://github.com/apache/ozone/pull/4883#discussion_r1230653902
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -2831,28 +2830,27 @@ public List<RepeatedOmKeyInfo> listTrash(String
volumeName,
public List<SnapshotInfo> listSnapshot(
String volumeName, String bucketName, String snapshotPrefix,
String prevSnapshot, int maxListResult) throws IOException {
- if (isAclEnabled) {
- omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
- ACLType.LIST, volumeName, bucketName, null);
- }
- boolean auditSuccess = true;
- Map<String, String> auditMap = buildAuditMap(volumeName);
- auditMap.put(OzoneConsts.BUCKET, bucketName);
+ metrics.incNumSnapshotLists();
+ Map<String, String> auditMap = new HashMap<>();
try {
- metrics.incNumSnapshotLists();
- return metadataManager.listSnapshot(volumeName, bucketName,
- snapshotPrefix, prevSnapshot, maxListResult);
+ if (isAclEnabled) {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.LIST, volumeName, bucketName, null);
+ }
+ auditMap = buildAuditMap(volumeName);
+ auditMap.put(OzoneConsts.BUCKET, bucketName);
Review Comment:
If ACL check rejects the request, audit log will not have volume/bucket
names. Not broken by this change, but I think it can be fixed in the same
patch. Only ACL check should be moved inside the `try` block.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]