[
https://issues.apache.org/jira/browse/HDFS-9395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15094501#comment-15094501
]
Colin Patrick McCabe commented on HDFS-9395:
If I understand correctly, the relevant code block is here:
{code}
ContentSummary getContentSummary(final String src) throws IOException {
checkOperation(OperationCategory.READ);
readLock();
boolean success = true;
try {
checkOperation(OperationCategory.READ);
return FSDirStatAndListingOp.getContentSummary(dir, src);
} catch (AccessControlException ace) {
success = false;
throw ace;
} finally {
readUnlock();
logAuditEvent(success, "contentSummary", src);
}
}
{code}
The code appears to be making the assumption that the only IOE that can be
thrown is {{AccessControlException}}. I don't think this is correct. It would
be better to change this to something like this, similar to our other audit log
use-cases:
{code}
ContentSummary getContentSummary(final String src) throws IOException {
checkOperation(OperationCategory.READ);
readLock();
boolean success = false;
try {
checkOperation(OperationCategory.READ);
ContentSummary csum = FSDirStatAndListingOp.getContentSummary(dir, src);
success = true;
return csum;
} catch (AccessControlException ace) {
throw ace;
} finally {
readUnlock();
logAuditEvent(success, "contentSummary", src);
}
}
{code}
bq. It's by design? HDFS-5163
No, it's a bug. Also, I looked at the code prior to the HDFS-4949 branch
merge, and the bug existed prior to HDFS-5163 or any of the other HDFS-4949
JIRAs.
Hope this helps.
> getContentSummary is audit logged as success even if failed
> ---
>
> Key: HDFS-9395
> URL: https://issues.apache.org/jira/browse/HDFS-9395
> Project: Hadoop HDFS
> Issue Type: Bug
>Reporter: Kihwal Lee
>Assignee: Kuhu Shukla
>
> Audit logging is in the fainally block along with the lock unlocking, so it
> is always logged as success even for cases like FileNotFoundException is
> thrown.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)