|
@@ -2527,6 +2527,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp
|
|
final ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp
|
|
.getErasureCodingPolicy(this, ecPolicyName, iip);
|
|
.getErasureCodingPolicy(this, ecPolicyName, iip);
|
|
if (ecPolicy != null && (!ecPolicy.isReplicationPolicy())) {
|
|
if (ecPolicy != null && (!ecPolicy.isReplicationPolicy())) {
|
|
|
|
+ checkErasureCodingSupported("createWithEC");
|
|
if (blockSize < ecPolicy.getCellSize()) {
|
|
if (blockSize < ecPolicy.getCellSize()) {
|
|
throw new IOException("Specified block size (" + blockSize
|
|
throw new IOException("Specified block size (" + blockSize
|
|
+ ") is less than the cell size (" + ecPolicy.getCellSize()
|
|
+ ") is less than the cell size (" + ecPolicy.getCellSize()
|
|
@@ -7597,6 +7598,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
UnresolvedLinkException, SafeModeException, AccessControlException {
|
|
UnresolvedLinkException, SafeModeException, AccessControlException {
|
|
final String operationName = "setErasureCodingPolicy";
|
|
final String operationName = "setErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
FileStatus resultingStat = null;
|
|
FileStatus resultingStat = null;
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
boolean success = false;
|
|
boolean success = false;
|
|
@@ -7629,6 +7631,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final String operationName = "addErasureCodingPolicies";
|
|
final String operationName = "addErasureCodingPolicies";
|
|
List<String> addECPolicyNames = new ArrayList<>(policies.length);
|
|
List<String> addECPolicyNames = new ArrayList<>(policies.length);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
List<AddErasureCodingPolicyResponse> responses =
|
|
List<AddErasureCodingPolicyResponse> responses =
|
|
new ArrayList<>(policies.length);
|
|
new ArrayList<>(policies.length);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
@@ -7670,6 +7673,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final boolean logRetryCache) throws IOException {
|
|
final boolean logRetryCache) throws IOException {
|
|
final String operationName = "removeErasureCodingPolicy";
|
|
final String operationName = "removeErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
writeLock();
|
|
writeLock();
|
|
try {
|
|
try {
|
|
@@ -7700,6 +7704,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final boolean logRetryCache) throws IOException {
|
|
final boolean logRetryCache) throws IOException {
|
|
final String operationName = "enableErasureCodingPolicy";
|
|
final String operationName = "enableErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
writeLock();
|
|
writeLock();
|
|
try {
|
|
try {
|
|
@@ -7731,6 +7736,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final boolean logRetryCache) throws IOException {
|
|
final boolean logRetryCache) throws IOException {
|
|
final String operationName = "disableErasureCodingPolicy";
|
|
final String operationName = "disableErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
LOG.info("Disable the erasure coding policy " + ecPolicyName);
|
|
LOG.info("Disable the erasure coding policy " + ecPolicyName);
|
|
writeLock();
|
|
writeLock();
|
|
@@ -7764,6 +7770,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
UnresolvedLinkException, SafeModeException, AccessControlException {
|
|
UnresolvedLinkException, SafeModeException, AccessControlException {
|
|
final String operationName = "unsetErasureCodingPolicy";
|
|
final String operationName = "unsetErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
FileStatus resultingStat = null;
|
|
FileStatus resultingStat = null;
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
boolean success = false;
|
|
boolean success = false;
|
|
@@ -7791,6 +7798,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final String operationName = "getErasureCodingPolicy";
|
|
final String operationName = "getErasureCodingPolicy";
|
|
boolean success = false;
|
|
boolean success = false;
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
final FSPermissionChecker pc = getPermissionChecker();
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
@@ -7812,6 +7820,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final String operationName = "getErasureCodingPolicies";
|
|
final String operationName = "getErasureCodingPolicies";
|
|
boolean success = false;
|
|
boolean success = false;
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
@@ -7832,6 +7841,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
final String operationName = "getErasureCodingCodecs";
|
|
final String operationName = "getErasureCodingCodecs";
|
|
boolean success = false;
|
|
boolean success = false;
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
|
|
+ checkErasureCodingSupported(operationName);
|
|
readLock();
|
|
readLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.READ);
|
|
checkOperation(OperationCategory.READ);
|
|
@@ -8224,5 +8234,19 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
return "disableRestoreFailedStorage";
|
|
return "disableRestoreFailedStorage";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check whether operation is supported.
|
|
|
|
+ * @param operationName the name of operation.
|
|
|
|
+ * @throws UnsupportedActionException throws UAE if not supported.
|
|
|
|
+ */
|
|
|
|
+ public void checkErasureCodingSupported(String operationName)
|
|
|
|
+ throws UnsupportedActionException {
|
|
|
|
+ if (!NameNodeLayoutVersion.supports(
|
|
|
|
+ NameNodeLayoutVersion.Feature.ERASURE_CODING,
|
|
|
|
+ getEffectiveLayoutVersion())) {
|
|
|
|
+ throw new UnsupportedActionException(operationName + " not supported.");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|