You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-05 16:15:50 +03:00
Took out the cache repopulate idea. Now we will only have warnings
of problems. I realized we can't reliably tell how big the cache is while the system is running. There's a window where write/append has added / is adding a journal file but hasn't told Cache about it yet. This capability will have to wait for now. This shouldn't be a problem because in theory, we will no longer have data whose size is not consistent with metadata stored outside of the file. If we do, it means there was either a hard failure, or SM was killed. Either way, SM will be restarted and the cache will populate its meta fresh then.
This commit is contained in:
@@ -127,13 +127,7 @@ PrefixCache::~PrefixCache()
|
||||
*/
|
||||
}
|
||||
|
||||
void PrefixCache::repopulate()
|
||||
{
|
||||
lru_mutex.lock();
|
||||
populate(false);
|
||||
}
|
||||
|
||||
void PrefixCache::populate(bool useSync)
|
||||
void PrefixCache::populate()
|
||||
{
|
||||
Synchronizer *sync = Synchronizer::get();
|
||||
bf::directory_iterator dir(cachePrefix);
|
||||
@@ -151,15 +145,13 @@ void PrefixCache::populate(bool useSync)
|
||||
auto last = lru.end();
|
||||
m_lru.insert(--last);
|
||||
currentCacheSize += bf::file_size(*dir);
|
||||
if (useSync)
|
||||
newObjects.push_back(p.filename().string());
|
||||
newObjects.push_back(p.filename().string());
|
||||
}
|
||||
else if (p != cachePrefix/downloader->getTmpPath())
|
||||
logger->log(LOG_WARNING, "Cache: found something in the cache that does not belong '%s'", p.string().c_str());
|
||||
++dir;
|
||||
}
|
||||
if (useSync)
|
||||
sync->newObjects(firstDir, newObjects);
|
||||
sync->newObjects(firstDir, newObjects);
|
||||
newObjects.clear();
|
||||
|
||||
// account for what's in the journal dir
|
||||
@@ -174,8 +166,7 @@ void PrefixCache::populate(bool useSync)
|
||||
{
|
||||
size_t s = bf::file_size(*dir);
|
||||
currentCacheSize += s;
|
||||
if (useSync)
|
||||
newJournals.push_back(pair<string, size_t>(p.stem().string(), s));
|
||||
newJournals.push_back(pair<string, size_t>(p.stem().string(), s));
|
||||
}
|
||||
else
|
||||
logger->log(LOG_WARNING, "Cache: found a file in the journal dir that does not belong '%s'", p.string().c_str());
|
||||
@@ -185,8 +176,7 @@ void PrefixCache::populate(bool useSync)
|
||||
++dir;
|
||||
}
|
||||
lru_mutex.unlock();
|
||||
if (useSync)
|
||||
sync->newJournalEntries(firstDir, newJournals);
|
||||
sync->newJournalEntries(firstDir, newJournals);
|
||||
}
|
||||
|
||||
// be careful using this! SM should be idle. No ongoing reads or writes.
|
||||
@@ -399,10 +389,9 @@ void PrefixCache::deletedJournal(size_t size)
|
||||
else
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "PrefixCache::deletedJournal(): Detected an accounting error." <<
|
||||
" Reloading cache metadata, this will pause IO activity briefly.";
|
||||
oss << "PrefixCache::deletedJournal(): Detected an accounting error.";
|
||||
logger->log(LOG_WARNING, oss.str().c_str());
|
||||
populate(false);
|
||||
currentCacheSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,10 +414,9 @@ void PrefixCache::deletedObject(const string &key, size_t size)
|
||||
else
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "PrefixCache::deletedObject(): Detected an accounting error." <<
|
||||
" Reloading cache metadata, this will pause IO activity briefly.";
|
||||
oss << "PrefixCache::deletedObject(): Detected an accounting error.";
|
||||
logger->log(LOG_WARNING, oss.str().c_str());
|
||||
populate(false);
|
||||
currentCacheSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user