HDFS-8321. CacheDirectives and CachePool operations should throw RetriableException in safemode. Contributed by Haohui Mai.

This commit is contained in:
Haohui Mai 2015-05-04 15:47:16 -07:00
parent f30065c8b6
commit 767b91cd83
2 changed files with 11 additions and 24 deletions

View File

@ -645,6 +645,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8325. Misspelling of threshold in log4j.properties for tests. HDFS-8325. Misspelling of threshold in log4j.properties for tests.
(Brahma Reddy Battula via aajisaka) (Brahma Reddy Battula via aajisaka)
HDFS-8321. CacheDirectives and CachePool operations should throw
RetriableException in safemode. (wheat9)
Release 2.7.1 - UNRELEASED Release 2.7.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

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