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 | |
parent | 3d35192a7cb2f0321ef54eb721ec21c40758e774 (diff) | |
download | sink-64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c.tar.gz sink-64d7d7bdd1edb2bcc305ca007784d0708cf7ef3c.zip |
Deal with not using the implicit internal transaction.
Diffstat (limited to 'common/storage')
-rw-r--r-- | common/storage/entitystore.cpp | 13 | ||||
-rw-r--r-- | common/storage/entitystore.h | 2 |
2 files changed, 10 insertions, 5 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) |
diff --git a/common/storage/entitystore.h b/common/storage/entitystore.h index be3817b..06ca8c4 100644 --- a/common/storage/entitystore.h +++ b/common/storage/entitystore.h | |||
@@ -47,7 +47,7 @@ public: | |||
47 | bool modify(const QByteArray &type, const ApplicationDomain::ApplicationDomainType &, const QByteArrayList &deletions, bool replayToSource, const PreprocessModification &); | 47 | bool modify(const QByteArray &type, const ApplicationDomain::ApplicationDomainType &, const QByteArrayList &deletions, bool replayToSource, const PreprocessModification &); |
48 | bool remove(const QByteArray &type, const QByteArray &uid, bool replayToSource, const PreprocessRemoval &); | 48 | bool remove(const QByteArray &type, const QByteArray &uid, bool replayToSource, const PreprocessRemoval &); |
49 | void cleanupRevision(qint64 revision); | 49 | void cleanupRevision(qint64 revision); |
50 | void cleanupRevisions(qint64 revision); | 50 | bool cleanupRevisions(qint64 revision); |
51 | 51 | ||
52 | void startTransaction(Sink::Storage::DataStore::AccessMode); | 52 | void startTransaction(Sink::Storage::DataStore::AccessMode); |
53 | void commitTransaction(); | 53 | void commitTransaction(); |