diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-11 21:17:41 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-12 09:04:44 +0200 |
commit | b73ae80dcd88e245dc1fa83c06f1d5356ea39196 (patch) | |
tree | 308da8e4c2501e937a7b8f50f4eaecc1d30b245d /common/storage_lmdb.cpp | |
parent | 56974b62bd07d844d7cf578722a24962ecefd8b4 (diff) | |
download | sink-b73ae80dcd88e245dc1fa83c06f1d5356ea39196.tar.gz sink-b73ae80dcd88e245dc1fa83c06f1d5356ea39196.zip |
Fixed the case when a dbi would leak through to a transaction where it
shouldn't be visible yet.
Was reproducible in the initial sync of the caldav resource.
Diffstat (limited to 'common/storage_lmdb.cpp')
-rw-r--r-- | common/storage_lmdb.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index fe3b303..f254077 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -222,7 +222,11 @@ public: | |||
222 | QReadLocker dbiLocker{&sDbisLock}; | 222 | QReadLocker dbiLocker{&sDbisLock}; |
223 | if (sDbis.contains(dbiName)) { | 223 | if (sDbis.contains(dbiName)) { |
224 | dbi = sDbis.value(dbiName); | 224 | dbi = sDbis.value(dbiName); |
225 | Q_ASSERT(dbiValidForTransaction(dbi, transaction)); | 225 | //sDbis can potentially contain a dbi that is not valid for this transaction, if this transaction was created before the dbi was created. |
226 | if (!dbiValidForTransaction(dbi, transaction)) { | ||
227 | SinkTrace() << "Found dbi that is not available for the current transaction."; | ||
228 | return false; | ||
229 | } | ||
226 | } else { | 230 | } else { |
227 | /* | 231 | /* |
228 | * Dynamic creation of databases. | 232 | * Dynamic creation of databases. |
@@ -250,7 +254,11 @@ public: | |||
250 | //Double checked locking | 254 | //Double checked locking |
251 | if (sDbis.contains(dbiName)) { | 255 | if (sDbis.contains(dbiName)) { |
252 | dbi = sDbis.value(dbiName); | 256 | dbi = sDbis.value(dbiName); |
253 | Q_ASSERT(dbiValidForTransaction(dbi, transaction)); | 257 | //sDbis can potentially contain a dbi that is not valid for this transaction, if this transaction was created before the dbi was created. |
258 | if (!dbiValidForTransaction(dbi, transaction)) { | ||
259 | SinkTrace() << "Found dbi that is not available for the current transaction."; | ||
260 | return false; | ||
261 | } | ||
254 | return true; | 262 | return true; |
255 | } | 263 | } |
256 | 264 | ||