[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [sink/develop] common: Avoid unnecesary warnings
From: Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date: 2016-06-30 19:49:33
Message-ID: E1bIhxt-0005c3-3c () code ! kde ! org
[Download RAW message or body]
Git commit 874b0d2be32e2edffedd59ab17bf821456757e29 by Christian Mollekopf.
Committed on 26/06/2016 at 12:40.
Pushed by cmollekopf into branch 'develop'.
Avoid unnecesary warnings
M +7 -5 common/pipeline.cpp
M +5 -0 common/queryrunner.cpp
M +7 -1 common/storage_lmdb.cpp
http://commits.kde.org/akonadi-next/874b0d2be32e2edffedd59ab17bf821456757e29
diff --git a/common/pipeline.cpp b/common/pipeline.cpp
index e3b9180..976a83f 100644
--- a/common/pipeline.cpp
+++ b/common/pipeline.cpp
@@ -115,11 +115,13 @@ void Pipeline::startTransaction()
//FIXME this is a temporary measure to recover from a failure to open the named \
databases correctly.
//Once the actual problem is fixed it will be enough to simply crash if we open \
the wrong database (which we check in openDatabase already).
//It seems like the validateNamedDatabase calls actually stops the mdb_put \
failures during sync...
- while (!d->transaction.validateNamedDatabases()) {
- Warning() << "Opened an invalid transaction!!!!!!";
- d->transaction = std::move(storage().createTransaction(Storage::ReadWrite, \
[](const Sink::Storage::Error &error) {
- Warning() << error.message;
- }));
+ if (d->storage.exists()) {
+ while (!d->transaction.validateNamedDatabases()) {
+ Warning() << "Opened an invalid transaction!!!!!!";
+ d->transaction = \
std::move(storage().createTransaction(Storage::ReadWrite, [](const \
Sink::Storage::Error &error) { + Warning() << error.message;
+ }));
+ }
}
}
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index 90f046b..78a4b94 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -207,6 +207,11 @@ Storage::Transaction QueryWorker<DomainType>::getTransaction()
Sink::Storage::Transaction transaction;
{
Sink::Storage storage(Sink::storageLocation(), mResourceInstanceIdentifier);
+ if (!storage.exists()) {
+ //This is not an error if the resource wasn't started before
+ Log() << "Store doesn't exist: " << mResourceInstanceIdentifier;
+ return Sink::Storage::Transaction();
+ }
storage.setDefaultErrorHandler([](const Sink::Storage::Error &error) { \
Warning() << "Error during query: " << error.store << error.message; }); transaction \
= storage.createTransaction(Sink::Storage::ReadOnly); }
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index aeb4dd6..3687594 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -524,7 +524,13 @@ QList<QByteArray> Storage::Transaction::getDatabaseNames() const
list << QByteArray::fromRawData((char *)key.mv_data, key.mv_size);
}
} else {
- Warning() << "Failed to get a value" << rc;
+ //Normal if we don't have any databases yet
+ if (rc == MDB_NOTFOUND) {
+ rc = 0;
+ }
+ if (rc) {
+ Warning() << "Failed to get a value" << rc;
+ }
}
} else {
Warning() << "Failed to open db" << rc << QByteArray(mdb_strerror(rc));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic