[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-20 Thread Yi Liu (JIRA)

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

Yi Liu commented on HDFS-7252:
--

Thanks [~vinayrpet] for the review and commit.

> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-18 Thread Hudson (JIRA)

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

Hudson commented on HDFS-7252:
--

FAILURE: Integrated in Hadoop-Hdfs-trunk #1905 (See 
[https://builds.apache.org/job/Hadoop-Hdfs-trunk/1905/])
HDFS-7252. small refinement to the use of isInAnEZ in FSNamesystem. (Yi Liu via 
vinayakumarb) (vinayakumarb: rev 368743140dd076ecd5af309c1ed83c5ae2d59fc8)
* hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
* 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java


> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-18 Thread Hudson (JIRA)

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

Hudson commented on HDFS-7252:
--

SUCCESS: Integrated in Hadoop-Yarn-trunk #716 (See 
[https://builds.apache.org/job/Hadoop-Yarn-trunk/716/])
HDFS-7252. small refinement to the use of isInAnEZ in FSNamesystem. (Yi Liu via 
vinayakumarb) (vinayakumarb: rev 368743140dd076ecd5af309c1ed83c5ae2d59fc8)
* hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
* 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java


> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-17 Thread Hudson (JIRA)

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

Hudson commented on HDFS-7252:
--

FAILURE: Integrated in Hadoop-Mapreduce-trunk #1929 (See 
[https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1929/])
HDFS-7252. small refinement to the use of isInAnEZ in FSNamesystem. (Yi Liu via 
vinayakumarb) (vinayakumarb: rev 368743140dd076ecd5af309c1ed83c5ae2d59fc8)
* hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
* 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java


> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-17 Thread Hudson (JIRA)

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

Hudson commented on HDFS-7252:
--

FAILURE: Integrated in Hadoop-trunk-Commit #6280 (See 
[https://builds.apache.org/job/Hadoop-trunk-Commit/6280/])
HDFS-7252. small refinement to the use of isInAnEZ in FSNamesystem. (Yi Liu via 
vinayakumarb) (vinayakumarb: rev 368743140dd076ecd5af309c1ed83c5ae2d59fc8)
* 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
* hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt


> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-17 Thread Vinayakumar B (JIRA)

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

Vinayakumar B commented on HDFS-7252:
-

Committed to trunk and branch-2. Thanks [~hitliuyi] for the patch and [~clamb] 
for the review.

> 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
> Fix For: 2.7.0
>
> Attachments: HDFS-7252.001.patch, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-17 Thread Vinayakumar B (JIRA)

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

Vinayakumar B commented on HDFS-7252:
-

+1, Patch looks good to me.

> 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, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-16 Thread Hadoop QA (JIRA)

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

Hadoop QA commented on HDFS-7252:
-

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12675225/HDFS-7252.002.patch
  against trunk revision 2894433.

{color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

{color:red}-1 tests included{color}.  The patch doesn't appear to include 
any new or modified tests.
Please justify why no new tests are needed for this 
patch.
Also please list what manual steps were performed to 
verify this patch.

{color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

{color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

{color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

{color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

{color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

{color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

  
org.apache.hadoop.hdfs.server.namenode.ha.TestDNFencingWithReplication
  org.apache.hadoop.hdfs.server.namenode.ha.TestDNFencing

{color:green}+1 contrib tests{color}.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/8439//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/8439//console

This message is automatically generated.

> 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, HDFS-7252.002.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)


[jira] [Commented] (HDFS-7252) small refinement to the use of isInAnEZ in FSNamesystem

2014-10-15 Thread Charles Lamb (JIRA)

[ 
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)