HDFS-12569. Unset EC policy logs empty payload in edit log. (Lei (Eddy) Xu)

This commit is contained in:
Lei Xu 2017-10-02 15:31:20 -07:00
parent 280080fad0
commit 27ffd43b64
3 changed files with 18 additions and 2 deletions

View File

@ -298,8 +298,7 @@ final class FSDirErasureCodingOp {
final List<XAttr> xattrs = Lists.newArrayListWithCapacity(1);
xattrs.add(ecXAttr);
FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP, xattrs);
return xattrs;
return FSDirXAttrOp.unprotectedRemoveXAttrs(fsd, srcIIP, xattrs);
}
/**

View File

@ -184,6 +184,10 @@ class FSDirXAttrOp {
return fsd.getAuditFileInfo(iip);
}
/**
* Remove xattrs from the inode, and return the <em>removed</em> xattrs.
* @return the <em>removed</em> xattrs.
*/
static List<XAttr> unprotectedRemoveXAttrs(
FSDirectory fsd, final INodesInPath iip, final List<XAttr> toRemove)
throws IOException {

View File

@ -362,4 +362,17 @@ public class TestUnsetAndChangeDirectoryEcPolicy {
+ ecFilePath, e);
}
}
/**
* Test unsetEcPolicy is persisted correctly in edit log.
*/
@Test
public void testUnsetEcPolicyInEditLog() throws IOException {
fs.getClient().setErasureCodingPolicy("/", ecPolicy.getName());
Assert.assertEquals(ecPolicy, fs.getErasureCodingPolicy(new Path("/")));
fs.getClient().unsetErasureCodingPolicy("/");
cluster.restartNameNode(true);
Assert.assertNull(fs.getErasureCodingPolicy(new Path("/")));
}
}