diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-24 09:57:34 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-24 09:57:34 +0100 |
commit | 64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c (patch) | |
tree | 37069947a889fd5209e2d1e0686c2783c0062f2e /common/storage/entitystore.cpp | |
parent | 3d35192a7cb2f0321ef54eb721ec21c40758e774 (diff) | |
download | sink-64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c.tar.gz sink-64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c.zip |
Deal with not using the implicit internal transaction.
Diffstat (limited to 'common/storage/entitystore.cpp')
-rw-r--r-- | common/storage/entitystore.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 79314ad..f6b8f43 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -307,7 +307,7 @@ void EntityStore::cleanupRevision(qint64 revision) | |||
307 | DataStore::setCleanedUpRevision(d->transaction, revision); | 307 | DataStore::setCleanedUpRevision(d->transaction, revision); |
308 | } | 308 | } |
309 | 309 | ||
310 | void EntityStore::cleanupRevisions(qint64 revision) | 310 | bool EntityStore::cleanupRevisions(qint64 revision) |
311 | { | 311 | { |
312 | bool implicitTransaction = false; | 312 | bool implicitTransaction = false; |
313 | if (!d->transaction) { | 313 | if (!d->transaction) { |
@@ -315,13 +315,18 @@ void EntityStore::cleanupRevisions(qint64 revision) | |||
315 | implicitTransaction = true; | 315 | implicitTransaction = true; |
316 | } | 316 | } |
317 | const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction); | 317 | const auto lastCleanRevision = DataStore::cleanedUpRevision(d->transaction); |
318 | SinkTrace() << "Cleaning up from " << lastCleanRevision + 1 << " to " << revision; | 318 | const auto firstRevisionToCleanup = lastCleanRevision + 1; |
319 | for (qint64 rev = lastCleanRevision + 1; rev <= revision; rev++) { | 319 | bool cleanupIsNecessary = firstRevisionToCleanup <= revision; |
320 | cleanupRevision(revision); | 320 | if (cleanupIsNecessary) { |
321 | SinkTrace() << "Cleaning up from " << firstRevisionToCleanup << " to " << revision; | ||
322 | for (qint64 rev = firstRevisionToCleanup; rev <= revision; rev++) { | ||
323 | cleanupRevision(revision); | ||
324 | } | ||
321 | } | 325 | } |
322 | if (implicitTransaction) { | 326 | if (implicitTransaction) { |
323 | commitTransaction(); | 327 | commitTransaction(); |
324 | } | 328 | } |
329 | return cleanupIsNecessary; | ||
325 | } | 330 | } |
326 | 331 | ||
327 | QVector<QByteArray> EntityStore::fullScan(const QByteArray &type) | 332 | QVector<QByteArray> EntityStore::fullScan(const QByteArray &type) |