[ https://issues.apache.org/jira/browse/HDFS-6951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14118149#comment-14118149 ]
Yi Liu commented on HDFS-6951: ------------------------------ Thanks [~clamb], looks good to me, just one comment: yes, this method declares {{this method is always called with writeLock of FSDirectory held}} but image loading breaks. Just add _writeLock_ is not good, we define a new method something like _unprotectedAddEncryptionZone_ for image loading, as Andrew's suggestion. Or find a better way? {code} @@ -2074,8 +2074,13 @@ public final void addToInodeMap(INode inode) { for (XAttr xattr : xattrs) { final String xaName = XAttrHelper.getPrefixName(xattr); if (CRYPTO_XATTR_ENCRYPTION_ZONE.equals(xaName)) { - ezManager.addEncryptionZone(inode.getId(), - new String(xattr.getValue())); + writeLock(); + try { + ezManager.addEncryptionZone(inode.getId(), + new String(xattr.getValue())); + } finally { + writeUnlock(); + } } } } {code} > Saving namespace and restarting NameNode will remove existing encryption zones > ------------------------------------------------------------------------------ > > Key: HDFS-6951 > URL: https://issues.apache.org/jira/browse/HDFS-6951 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: encryption > Affects Versions: 3.0.0 > Reporter: Stephen Chu > Assignee: Charles Lamb > Attachments: HDFS-6951-prelim.002.patch, HDFS-6951-testrepo.patch, > HDFS-6951.001.patch, HDFS-6951.002.patch, HDFS-6951.003.patch, editsStored > > > Currently, when users save namespace and restart the NameNode, pre-existing > encryption zones will be wiped out. > I could reproduce this on a pseudo-distributed cluster: > * Create an encryption zone > * List encryption zones and verify the newly created zone is present > * Save the namespace > * Kill and restart the NameNode > * List the encryption zones and you'll find the encryption zone is missing > I've attached a test case for {{TestEncryptionZones}} that reproduces this as > well. Removing the saveNamespace call will get the test to pass. -- This message was sent by Atlassian JIRA (v6.3.4#6332)