HDFS-12066. When Namenode is in safemode,may not allowed to remove an user's erasure coding policy. Contributed by lufei.
This commit is contained in:
parent
1040bae6fc
commit
e3ae3e2644
|
@ -7113,6 +7113,9 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
|
checkOperation(OperationCategory.WRITE);
|
||||||
|
checkNameNodeSafeMode("Cannot remove erasure coding policy "
|
||||||
|
+ ecPolicyName);
|
||||||
FSDirErasureCodingOp.removeErasureCodePolicy(this, ecPolicyName);
|
FSDirErasureCodingOp.removeErasureCodePolicy(this, ecPolicyName);
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -482,6 +482,15 @@ public class TestSafeMode {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
dfs.removeErasureCodingPolicy("testECName");
|
||||||
|
fail("RemoveErasureCodingPolicy should have failed.");
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
GenericTestUtils.assertExceptionContains(
|
||||||
|
"Cannot remove erasure coding policy", ioe);
|
||||||
|
// expected
|
||||||
|
}
|
||||||
|
|
||||||
assertFalse("Could not leave SM",
|
assertFalse("Could not leave SM",
|
||||||
dfs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE));
|
dfs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue