From b73ae80dcd88e245dc1fa83c06f1d5356ea39196 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 11 Jul 2018 21:17:41 +0200 Subject: 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. --- common/storage_lmdb.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'common') 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: QReadLocker dbiLocker{&sDbisLock}; if (sDbis.contains(dbiName)) { dbi = sDbis.value(dbiName); - Q_ASSERT(dbiValidForTransaction(dbi, transaction)); + //sDbis can potentially contain a dbi that is not valid for this transaction, if this transaction was created before the dbi was created. + if (!dbiValidForTransaction(dbi, transaction)) { + SinkTrace() << "Found dbi that is not available for the current transaction."; + return false; + } } else { /* * Dynamic creation of databases. @@ -250,7 +254,11 @@ public: //Double checked locking if (sDbis.contains(dbiName)) { dbi = sDbis.value(dbiName); - Q_ASSERT(dbiValidForTransaction(dbi, transaction)); + //sDbis can potentially contain a dbi that is not valid for this transaction, if this transaction was created before the dbi was created. + if (!dbiValidForTransaction(dbi, transaction)) { + SinkTrace() << "Found dbi that is not available for the current transaction."; + return false; + } return true; } -- cgit v1.2.3