From 168a1dd194b601327019b838ccb351aed4070f46 Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Mon, 20 May 2019 15:51:45 -0500 Subject: [PATCH] Undid a bad fix I made where Cache would potentially delete the wrong file on a flush. --- src/Cache.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index db53194f4..237b8142f 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -426,10 +426,13 @@ void Cache::_makeSpace(size_t size) assert(currentCacheSize >= (size_t) statbuf.st_size); currentCacheSize -= statbuf.st_size; thisMuch -= statbuf.st_size; - //logger->log(LOG_WARNING, "Cache: flushing! Try to avoid this, it may deadlock!"); + //logger->log(LOG_WARNING, "Cache: flushing!"); Synchronizer::get()->flushObject(*it); - cachedFile = prefix / *it; // it might have been renamed by the flush - replicator->remove(cachedFile, Replicator::LOCAL_ONLY); + #ifndef NDEBUG + assert(replicator->remove(cachedFile, Replicator::LOCAL_ONLY) == 0); + #else + replicator->remove(cachedFile, Replicator::LOCAL_ONLY); + #endif LRU_t::iterator toRemove = it++; m_lru.erase(*toRemove); lru.erase(toRemove);