summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/genericresource.cpp5
-rw-r--r--common/pipeline.cpp1
-rw-r--r--common/storage/entitystore.cpp8
3 files changed, 11 insertions, 3 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index e36b750..7c4d4ea 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -186,12 +186,13 @@ private slots:
186 { 186 {
187 auto time = QSharedPointer<QTime>::create(); 187 auto time = QSharedPointer<QTime>::create();
188 time->start(); 188 time->start();
189 mPipeline->startTransaction();
190 mPipeline->cleanupRevisions(mLowerBoundRevision); 189 mPipeline->cleanupRevisions(mLowerBoundRevision);
191 mPipeline->commit();
192 SinkTrace() << "Cleanup done." << Log::TraceTime(time->elapsed()); 190 SinkTrace() << "Cleanup done." << Log::TraceTime(time->elapsed());
193 191
194 // Go through all message queues 192 // Go through all message queues
193 if (mCommandQueues.isEmpty()) {
194 return KAsync::null<void>();
195 }
195 auto it = QSharedPointer<QListIterator<MessageQueue *>>::create(mCommandQueues); 196 auto it = QSharedPointer<QListIterator<MessageQueue *>>::create(mCommandQueues);
196 return KAsync::dowhile( 197 return KAsync::dowhile(
197 [it, this]() { 198 [it, this]() {
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index 9a4f431..d3668bc 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -288,7 +288,6 @@ KAsync::Job<qint64> Pipeline::deletedEntity(void const *command, size_t size)
288void Pipeline::cleanupRevisions(qint64 revision) 288void Pipeline::cleanupRevisions(qint64 revision)
289{ 289{
290 d->entityStore.cleanupRevisions(revision); 290 d->entityStore.cleanupRevisions(revision);
291 d->revisionChanged = true;
292} 291}
293 292
294 293
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp
index 3512e34..79314ad 100644
--- a/common/storage/entitystore.cpp
+++ b/common/storage/entitystore.cpp
@@ -309,11 +309,19 @@ void EntityStore::cleanupRevision(qint64 revision)
309 309
310void EntityStore::cleanupRevisions(qint64 revision) 310void EntityStore::cleanupRevisions(qint64 revision)
311{ 311{
312 bool implicitTransaction = false;
313 if (!d->transaction) {
314 startTransaction(Sink::Storage::DataStore::ReadWrite);
315 implicitTransaction = true;
316 }
312 const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction); 317 const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction);
313 SinkTrace() << "Cleaning up from " << lastCleanRevision + 1 << " to " << revision; 318 SinkTrace() << "Cleaning up from " << lastCleanRevision + 1 << " to " << revision;
314 for (qint64 rev = lastCleanRevision + 1; rev <= revision; rev++) { 319 for (qint64 rev = lastCleanRevision + 1; rev <= revision; rev++) {
315 cleanupRevision(revision); 320 cleanupRevision(revision);
316 } 321 }
322 if (implicitTransaction) {
323 commitTransaction();
324 }
317} 325}
318 326
319QVector<QByteArray> EntityStore::fullScan(const QByteArray &type) 327QVector<QByteArray> EntityStore::fullScan(const QByteArray &type)