fix retry cache cleaner.
@@ -9773,14 +9773,14 @@ public RetryCacheCleaner() {
@Override
public void run() {
- try {
int numRun = 0;
while (fsRunning && shouldCacheCleanerRun) {
+ try {
final List<CacheEntry> toRemove = new ArrayList<>();
int num = retryCache.getToRemove().drainTo(toRemove);
if (num > 0) {
- HopsTransactionalRequestHandler rh = new HopsTransactionalRequestHandler
- (HDFSOperationType.CLEAN_RETRY_CACHE) {
+ HopsTransactionalRequestHandler rh
+ = new HopsTransactionalRequestHandler(HDFSOperationType.CLEAN_RETRY_CACHE) {
@Override
public void acquireLock(TransactionLocks locks) throws IOException {
LockFactory lf = getInstance();
@@ -9790,8 +9790,11 @@ public void acquireLock(TransactionLocks locks) throws IOException {
@Override
public Object performTask() throws IOException {
for (CacheEntry entry : toRemove) {
+ if (EntityManager.find(RetryCacheEntry.Finder.ByClientIdAndCallId, entry.getClientId(), entry.
+ getCallId()) != null) {
EntityManager.remove(new RetryCacheEntry(entry.getClientId(), entry.getCallId()));
}
+ }
return null;
}
};
@@ -9814,11 +9817,11 @@ public Object performTask() throws IOException {
Thread.sleep(1000);
numRun++;
- }
} catch (Exception e) {
FSNamesystem.LOG.error("Exception in RetryCacheCleaner: ", e);
}
}
+ }
public void stopMonitor() {
shouldCacheCleanerRun = false;
