You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-17 01:02:23 +03:00
Added printing the element count with the cache size on SIGUSR1.
Not atomic, but good enough for debugging purposes.
This commit is contained in:
@@ -256,7 +256,7 @@ void Cache::read(const vector<string> &keys)
|
|||||||
}
|
}
|
||||||
if (keysToFetch.empty())
|
if (keysToFetch.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert(s.owns_lock());
|
assert(s.owns_lock());
|
||||||
downloader.download(keysToFetch, &dlErrnos, &dlSizes);
|
downloader.download(keysToFetch, &dlErrnos, &dlSizes);
|
||||||
assert(s.owns_lock());
|
assert(s.owns_lock());
|
||||||
@@ -429,11 +429,7 @@ void Cache::_makeSpace(size_t size)
|
|||||||
//logger->log(LOG_WARNING, "Cache: flushing!");
|
//logger->log(LOG_WARNING, "Cache: flushing!");
|
||||||
Synchronizer::get()->flushObject(*it);
|
Synchronizer::get()->flushObject(*it);
|
||||||
cachedFile = prefix / *it; // Sync may have renamed it
|
cachedFile = prefix / *it; // Sync may have renamed it
|
||||||
#ifndef NDEBUG
|
replicator->remove(cachedFile, Replicator::LOCAL_ONLY);
|
||||||
assert(replicator->remove(cachedFile, Replicator::LOCAL_ONLY) == 0);
|
|
||||||
#else
|
|
||||||
replicator->remove(cachedFile, Replicator::LOCAL_ONLY);
|
|
||||||
#endif
|
|
||||||
LRU_t::iterator toRemove = it++;
|
LRU_t::iterator toRemove = it++;
|
||||||
m_lru.erase(*toRemove);
|
m_lru.erase(*toRemove);
|
||||||
lru.erase(toRemove);
|
lru.erase(toRemove);
|
||||||
@@ -491,6 +487,13 @@ size_t Cache::getCurrentCacheSize() const
|
|||||||
return currentCacheSize;
|
return currentCacheSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t Cache::getCurrentCacheElementCount() const
|
||||||
|
{
|
||||||
|
boost::unique_lock<boost::recursive_mutex> s(lru_mutex);
|
||||||
|
assert(m_lru.size() == lru.size());
|
||||||
|
return m_lru.size();
|
||||||
|
}
|
||||||
|
|
||||||
void Cache::reset()
|
void Cache::reset()
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::recursive_mutex> s(lru_mutex);
|
boost::unique_lock<boost::recursive_mutex> s(lru_mutex);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class Cache : public boost::noncopyable
|
|||||||
void setMaxCacheSize(size_t size);
|
void setMaxCacheSize(size_t size);
|
||||||
void makeSpace(size_t size);
|
void makeSpace(size_t size);
|
||||||
size_t getCurrentCacheSize() const;
|
size_t getCurrentCacheSize() const;
|
||||||
|
size_t getCurrentCacheElementCount() const;
|
||||||
size_t getMaxCacheSize() const;
|
size_t getMaxCacheSize() const;
|
||||||
|
|
||||||
// test helpers
|
// test helpers
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using namespace storagemanager;
|
|||||||
void printCacheUsage(int sig)
|
void printCacheUsage(int sig)
|
||||||
{
|
{
|
||||||
cout << "Current cache size = " << Cache::get()->getCurrentCacheSize() << endl;
|
cout << "Current cache size = " << Cache::get()->getCurrentCacheSize() << endl;
|
||||||
|
cout << "Cache element count = " << Cache::get()->getCurrentCacheElementCount() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|||||||
Reference in New Issue
Block a user