1
0
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:
Patrick LeBlanc
2019-05-23 13:42:31 -05:00
parent a32e6c7bb4
commit 6bd44eae5a
3 changed files with 11 additions and 6 deletions

View File

@@ -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
assert(replicator->remove(cachedFile, Replicator::LOCAL_ONLY) == 0);
#else
replicator->remove(cachedFile, Replicator::LOCAL_ONLY); 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);

View File

@@ -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

View File

@@ -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)