|
@@ -7407,29 +7407,31 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
* @param ecPolicyName the name of the policy to be enabled
|
|
* @param ecPolicyName the name of the policy to be enabled
|
|
* @param logRetryCache whether to record RPC ids in editlog for retry cache
|
|
* @param logRetryCache whether to record RPC ids in editlog for retry cache
|
|
* rebuilding
|
|
* rebuilding
|
|
|
|
+ * @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- void enableErasureCodingPolicy(String ecPolicyName,
|
|
|
|
|
|
+ boolean enableErasureCodingPolicy(String ecPolicyName,
|
|
final boolean logRetryCache) throws IOException {
|
|
final boolean logRetryCache) throws IOException {
|
|
final String operationName = "enableErasureCodingPolicy";
|
|
final String operationName = "enableErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
boolean success = false;
|
|
boolean success = false;
|
|
- LOG.info("Enable the erasure coding policy " + ecPolicyName);
|
|
|
|
writeLock();
|
|
writeLock();
|
|
try {
|
|
try {
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot enable erasure coding policy "
|
|
checkNameNodeSafeMode("Cannot enable erasure coding policy "
|
|
+ ecPolicyName);
|
|
+ ecPolicyName);
|
|
- FSDirErasureCodingOp.enableErasureCodingPolicy(this, ecPolicyName,
|
|
|
|
- logRetryCache);
|
|
|
|
- success = true;
|
|
|
|
|
|
+ success = FSDirErasureCodingOp.enableErasureCodingPolicy(this,
|
|
|
|
+ ecPolicyName, logRetryCache);
|
|
|
|
+ } catch (AccessControlException ace) {
|
|
|
|
+ logAuditEvent(false, operationName, ecPolicyName, null, null);
|
|
} finally {
|
|
} finally {
|
|
writeUnlock(operationName);
|
|
writeUnlock(operationName);
|
|
if (success) {
|
|
if (success) {
|
|
getEditLog().logSync();
|
|
getEditLog().logSync();
|
|
|
|
+ logAuditEvent(success, operationName, ecPolicyName, null, null);
|
|
}
|
|
}
|
|
- logAuditEvent(success, operationName, ecPolicyName, null, null);
|
|
|
|
}
|
|
}
|
|
|
|
+ return success;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -7439,7 +7441,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
* rebuilding
|
|
* rebuilding
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- void disableErasureCodingPolicy(String ecPolicyName,
|
|
|
|
|
|
+ boolean disableErasureCodingPolicy(String ecPolicyName,
|
|
final boolean logRetryCache) throws IOException {
|
|
final boolean logRetryCache) throws IOException {
|
|
final String operationName = "disableErasureCodingPolicy";
|
|
final String operationName = "disableErasureCodingPolicy";
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
@@ -7450,16 +7452,18 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkOperation(OperationCategory.WRITE);
|
|
checkNameNodeSafeMode("Cannot disable erasure coding policy "
|
|
checkNameNodeSafeMode("Cannot disable erasure coding policy "
|
|
+ ecPolicyName);
|
|
+ ecPolicyName);
|
|
- FSDirErasureCodingOp.disableErasureCodingPolicy(this, ecPolicyName,
|
|
|
|
- logRetryCache);
|
|
|
|
- success = true;
|
|
|
|
|
|
+ success = FSDirErasureCodingOp.disableErasureCodingPolicy(this,
|
|
|
|
+ ecPolicyName, logRetryCache);
|
|
|
|
+ } catch (AccessControlException ace) {
|
|
|
|
+ logAuditEvent(false, operationName, ecPolicyName, null, null);
|
|
} finally {
|
|
} finally {
|
|
writeUnlock(operationName);
|
|
writeUnlock(operationName);
|
|
if (success) {
|
|
if (success) {
|
|
getEditLog().logSync();
|
|
getEditLog().logSync();
|
|
|
|
+ logAuditEvent(success, operationName, ecPolicyName, null, null);
|
|
}
|
|
}
|
|
- logAuditEvent(success, operationName, ecPolicyName, null, null);
|
|
|
|
}
|
|
}
|
|
|
|
+ return success;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|