HDFS-12569. Unset EC policy logs empty payload in edit log. (Lei (Eddy) Xu)
This commit is contained in:
parent
280080fad0
commit
27ffd43b64
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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("/")));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue