Commit 48ffdb6b authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

StorageJanitor: flush CollectionStatitics cache

Flush the cache when running 'akonadictl fsck' since any potential
changes that the Janitor does don't usually go through the
NotificationCollector, so there's a chance that the cache will be
out-of-date after the fsck.
parent 9c6b4038
...@@ -88,6 +88,12 @@ void CollectionStatistics::invalidateCollection(const Collection &col) ...@@ -88,6 +88,12 @@ void CollectionStatistics::invalidateCollection(const Collection &col)
mCache.remove(col.id()); mCache.remove(col.id());
} }
void CollectionStatistics::expireCache()
{
QMutexLocker lock(&mCacheLock);
mCache.clear();
}
const CollectionStatistics::Statistics CollectionStatistics::statistics(const Collection &col) const CollectionStatistics::Statistics CollectionStatistics::statistics(const Collection &col)
{ {
QMutexLocker lock(&mCacheLock); QMutexLocker lock(&mCacheLock);
......
...@@ -64,6 +64,8 @@ public: ...@@ -64,6 +64,8 @@ public:
void invalidateCollection(const Collection &col); void invalidateCollection(const Collection &col);
void expireCache();
protected: protected:
virtual Statistics calculateCollectionStatistics(const Collection &col); virtual Statistics calculateCollectionStatistics(const Collection &col);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "storage/selectquerybuilder.h" #include "storage/selectquerybuilder.h"
#include "storage/parthelper.h" #include "storage/parthelper.h"
#include "storage/dbconfig.h" #include "storage/dbconfig.h"
#include "storage/collectionstatistics.h"
#include "search/searchrequest.h" #include "search/searchrequest.h"
#include "search/searchmanager.h" #include "search/searchmanager.h"
#include "resourcemanager.h" #include "resourcemanager.h"
...@@ -133,6 +134,9 @@ void StorageJanitor::check() // implementation of `akonadictl fsck` ...@@ -133,6 +134,9 @@ void StorageJanitor::check() // implementation of `akonadictl fsck`
inform("Checking search index consistency..."); inform("Checking search index consistency...");
findOprhanSearchIndexEntries(); findOprhanSearchIndexEntries();
inform("Flushing collection statistics memory cache...");
CollectionStatistics::self()->expireCache();
/* TODO some ideas for further checks: /* TODO some ideas for further checks:
* the collection tree is non-cyclic * the collection tree is non-cyclic
* content type constraints of collections are not violated * content type constraints of collections are not violated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment