hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Lamb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem
Date Wed, 15 Oct 2014 13:25:33 GMT

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

Charles Lamb commented on HDFS-7252:
------------------------------------

[~hitliuyi],

Good idea. I only have a small nit. You can add "final" to the two decls of "zone" and ezKeyName.

Charles


> small refinement to the use of isInAnEZ in FSNamesystem
> -------------------------------------------------------
>
>                 Key: HDFS-7252
>                 URL: https://issues.apache.org/jira/browse/HDFS-7252
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 2.6.0
>            Reporter: Yi Liu
>            Assignee: Yi Liu
>            Priority: Trivial
>         Attachments: HDFS-7252.001.patch
>
>
> In {{FSN#startFileInt}}, _EncryptionZoneManager#getEncryptionZoneForPath_ is invoked
3 times (_dir.isInAnEZ(iip)_, _dir.getEZForPath(iip)_, _dir.getKeyName(iip)_) in following
code, actually we just need one.
> {code}
> if (dir.isInAnEZ(iip)) {
>           EncryptionZone zone = dir.getEZForPath(iip);
>           protocolVersion = chooseProtocolVersion(zone, supportedVersions);
>           suite = zone.getSuite();
>           ezKeyName = dir.getKeyName(iip);
>           Preconditions.checkNotNull(protocolVersion);
>           Preconditions.checkNotNull(suite);
>           Preconditions.checkArgument(!suite.equals(CipherSuite.UNKNOWN),
>               "Chose an UNKNOWN CipherSuite!");
>           Preconditions.checkNotNull(ezKeyName);
>         }
> {code}
> Also there are 2 times in following code, but just need one
> {code}
> if (dir.isInAnEZ(iip)) {
>       // The path is now within an EZ, but we're missing encryption parameters
>       if (suite == null || edek == null) {
>         throw new RetryStartFileException();
>       }
>       // Path is within an EZ and we have provided encryption parameters.
>       // Make sure that the generated EDEK matches the settings of the EZ.
>       String ezKeyName = dir.getKeyName(iip);
>       if (!ezKeyName.equals(edek.getEncryptionKeyName())) {
>         throw new RetryStartFileException();
>       }
>       feInfo = new FileEncryptionInfo(suite, version,
>           edek.getEncryptedKeyVersion().getMaterial(),
>           edek.getEncryptedKeyIv(),
>           ezKeyName, edek.getEncryptionKeyVersionName());
>       Preconditions.checkNotNull(feInfo);
>     }
> {code}



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

Mime
View raw message