|
@@ -7679,10 +7679,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
writeLock();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot add cache directive", safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot add cache directive");
|
|
|
effectiveDirective = FSNDNCacheOp.addCacheDirective(this, cacheManager,
|
|
|
directive, flags, logRetryCache);
|
|
|
} finally {
|
|
@@ -7710,10 +7707,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
writeLock();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot add cache directive", safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot add cache directive");
|
|
|
FSNDNCacheOp.modifyCacheDirective(this, cacheManager, directive, flags,
|
|
|
logRetryCache);
|
|
|
success = true;
|
|
@@ -7734,10 +7728,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
writeLock();
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot remove cache directives", safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot remove cache directives");
|
|
|
FSNDNCacheOp.removeCacheDirective(this, cacheManager, id, logRetryCache);
|
|
|
success = true;
|
|
|
} finally {
|
|
@@ -7777,10 +7768,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
String poolInfoStr = null;
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot add cache pool " + req.getPoolName(), safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot add cache pool"
|
|
|
+ + (req == null ? null : req.getPoolName()));
|
|
|
CachePoolInfo info = FSNDNCacheOp.addCachePool(this, cacheManager, req,
|
|
|
logRetryCache);
|
|
|
poolInfoStr = info.toString();
|
|
@@ -7800,10 +7789,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot modify cache pool " + req.getPoolName(), safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot modify cache pool"
|
|
|
+ + (req == null ? null : req.getPoolName()));
|
|
|
FSNDNCacheOp.modifyCachePool(this, cacheManager, req, logRetryCache);
|
|
|
success = true;
|
|
|
} finally {
|
|
@@ -7824,10 +7811,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
boolean success = false;
|
|
|
try {
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
- if (isInSafeMode()) {
|
|
|
- throw new SafeModeException(
|
|
|
- "Cannot remove cache pool " + cachePoolName, safeMode);
|
|
|
- }
|
|
|
+ checkNameNodeSafeMode("Cannot modify cache pool" + cachePoolName);
|
|
|
FSNDNCacheOp.removeCachePool(this, cacheManager, cachePoolName,
|
|
|
logRetryCache);
|
|
|
success = true;
|