[ 
https://issues.apache.org/jira/browse/HDFS-10458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhe Zhang updated HDFS-10458:
-----------------------------
    Attachment: HDFSA-10458.01.patch

Thanks [~shv] for the review. Attaching new patch to take the suggestion. I 
think it is a good idea to add the check in {{getEncryptionZoneForPath}}.

However, for uses in {{startFile}} etc., we should be more careful about race 
conditions. Therefore I added a boolean variable that can only be turned on 
once (can never be turned off). It is turned on *before* adding any encryption 
zone so it is safe to assume no EZ exists if the variable is false.

> getFileEncryptionInfo should return quickly for non-encrypted cluster
> ---------------------------------------------------------------------
>
>                 Key: HDFS-10458
>                 URL: https://issues.apache.org/jira/browse/HDFS-10458
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: encryption, namenode
>    Affects Versions: 2.6.0
>            Reporter: Zhe Zhang
>            Assignee: Zhe Zhang
>         Attachments: HDFS-10458.00.patch, HDFSA-10458.01.patch
>
>
> {{FSDirectory#getFileEncryptionInfo}} always acquires {{readLock}} and checks 
> if the path belongs to an EZ. For a busy system with potentially many listing 
> operations, this could cause locking contention.
> I think we should add a call {{EncryptionZoneManager#hasEncryptionZone()}} to 
> return whether the system has any EZ. If no EZ at all, 
> {{getFileEncryptionInfo}} should return null without {{readLock}}.
> If {{hasEncryptionZone}} is only used in the above scenario, maybe itself 
> doesn't need a {{readLock}} -- if the system doesn't have any EZ when 
> {{getFileEncryptionInfo}} is called on a path, it means the path cannot be 
> encrypted.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to