[ 
https://issues.apache.org/jira/browse/HDFS-13772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585458#comment-16585458
 ] 

Vinayakumar B commented on HDFS-13772:
--------------------------------------

bq. For practicality, I think we can consider this jira a bug fix - which makes 
things more accurate. As far as audits are concerned, because previously we 
always log an event with success==true, IMO if we fix it the same way as 
renameTo, so that only succeeded ops log an event (with success==true), we 
should be fine. Logging success==false would be a new introduction and be 
avoided when we still can.
Right. I think we can handle {{enable/disableErasureCodingPolicy()}} rpcs in 
this jira. For remaining (especially admin commands) can be discussed in 
separate jira.

bq. But compat is compat. So if you disagree with the above approach and think 
we should be 100% consistent, I'm ok with always logging the audit with true 
regardless of the actual return value....
Here is the current procedure for audit logging (based on seeing the user RPCs 
in FSNameSystem).
1. If AccessControlException, log audit with allowed=false.
2. If No AccessControlException and if operation is success, then log audit 
with allowed=true. If operation is NOT success, then skip audit log.

Code pattern will be as below.
{code}
boolean success=false;
try {
  //.. do op
  success=true
} catch (AccessControlException ace){
  logAudit(false);
} finally {
  if(success){
    logAudit(true);
  }
}
{code}
Most of the RPCs where {{logAudit(true)}} is outside {{finally()}} will throw 
exception in case of failure in operation.  So audit will not get logged in 
case of failure.

For this Jira,
So you are right. We can catch {{AccessControlException}}, {{logAudit(false)}} 
and in finally based on {{success}}, {{logAudit(true)}}.

[~ayushtkn], Please update the patch as mentioned.

> Erasure coding: Unnecessary NameNode Logs displaying for Enabling/Disabling 
> Erasure coding policies which are already enabled/disabled
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-13772
>                 URL: https://issues.apache.org/jira/browse/HDFS-13772
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: erasure-coding
>    Affects Versions: 3.0.0
>         Environment: 3 Node SuSE Linux cluster 
>            Reporter: Souryakanta Dwivedy
>            Assignee: Ayush Saxena
>            Priority: Trivial
>         Attachments: EC_capture1.PNG, HDFS-13772-01.patch, 
> HDFS-13772-02.patch, HDFS-13772-03 .patch, HDFS-13772-04.patch, 
> HDFS-13772-05.patch, HDFS-13772-06.patch
>
>
> Unnecessary NameNode Logs displaying for Enabling/Disabling Erasure coding 
> policies which are already enabled/disabled
> - Enable any Erasure coding policy like "RS-LEGACY-6-3-1024k"
> - Check the console log display as "Erasure coding policy RS-LEGACY-6-3-1024k 
> is enabled"
> - Again try to enable the same policy multiple times "hdfs ec -enablePolicy 
> -policy RS-LEGACY-6-3-1024k"
>  instead of throwing error message as ""policy already enabled"" it will 
> display same messages as "Erasure coding policy RS-LEGACY-6-3-1024k is 
> enabled"
> - Also in NameNode log policy enabled logs are displaying multiple times 
> unnecessarily even though the policy is already enabled.
>  like this : 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Disable 
> the erasure coding policy RS-10-4-1024k
> 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Disable 
> the erasure coding policy RS-10-4-1024k
> 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Disable 
> the erasure coding policy RS-10-4-1024k
> 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Enable the 
> erasure coding policy RS-LEGACY-6-3-1024k
> 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Enable the 
> erasure coding policy RS-LEGACY-6-3-1024k
> 2018-07-27 18:50:35,084 INFO 
> org.apache.hadoop.hdfs.server.namenode.ErasureCodingPolicyManager: Enable the 
> erasure coding policy RS-LEGACY-6-3-1024k
> - While executing the Erasure coding policy disable command also same type of 
> logs coming multiple times even though the policy is already 
>  disabled.It should throw error message as ""policy is already disabled"" for 
> already disabled policy.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to