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

Gera Shegalov commented on HADOOP-10557:
----------------------------------------

That's a good idea, Akira. Some comments:

{code}
@@ -48,7 +55,8 @@
   private boolean preserve = false;
   private boolean verifyChecksum = true;
   private boolean writeChecksum = true;
-  
+  private Map<FileSystem, Boolean> supportAclsCache = Maps.newHashMap();
+
{code}
supportAclsCache should be declared as a final instance variable. {{private 
final Map...}} 
\\
\\
{code}
+  protected boolean supportAcl(FileSystem fs) {
+    if (supportAclsCache.containsKey(fs)) {
+      return supportAclsCache.get(fs);
+    }
{code}
containsKey and get are 2 lookups in the hash map. Do it only once: 
{code}
final Boolean res = supportAclsCache.get(fs);
if (res != null) {
  return res;
}
{code}
\\
\\
{code}
+    try {
+      fs.getAclStatus(new Path(Path.SEPARATOR));
+    } catch (Exception e) {
+      supportAclsCache.put(fs, false);
+      return false;
+    }
{code}

Catch should be only for {{UnsupportedOperationException}}, it would probably 
be useful to log it as well. All other exceptions should be thrown unchanged. 






> FsShell -cp -p does not preserve extended ACLs
> ----------------------------------------------
>
>                 Key: HADOOP-10557
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10557
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Akira AJISAKA
>            Assignee: Akira AJISAKA
>         Attachments: HADOOP-10557.patch
>
>
> This issue tracks enhancing FsShell cp to
> * preserve extended ACLs by -p option
> or
> * add a new command-line option for preserving extended ACLs.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to