diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-26 14:40:13 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-26 14:40:13 +0200 |
commit | 874b0d2be32e2edffedd59ab17bf821456757e29 (patch) | |
tree | 91c6c28f82b497455f5df85926e701f43c2993c1 /common | |
parent | cb81ef8f69f6a48ed505f5aef50c62a10aa67283 (diff) | |
download | sink-874b0d2be32e2edffedd59ab17bf821456757e29.tar.gz sink-874b0d2be32e2edffedd59ab17bf821456757e29.zip |
Avoid unnecesary warnings
Diffstat (limited to 'common')
-rw-r--r-- | common/pipeline.cpp | 12 | ||||
-rw-r--r-- | common/queryrunner.cpp | 5 | ||||
-rw-r--r-- | common/storage_lmdb.cpp | 8 |
3 files changed, 19 insertions, 6 deletions
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() | |||
115 | //FIXME this is a temporary measure to recover from a failure to open the named databases correctly. | 115 | //FIXME this is a temporary measure to recover from a failure to open the named databases correctly. |
116 | //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). | 116 | //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). |
117 | //It seems like the validateNamedDatabase calls actually stops the mdb_put failures during sync... | 117 | //It seems like the validateNamedDatabase calls actually stops the mdb_put failures during sync... |
118 | while (!d->transaction.validateNamedDatabases()) { | 118 | if (d->storage.exists()) { |
119 | Warning() << "Opened an invalid transaction!!!!!!"; | 119 | while (!d->transaction.validateNamedDatabases()) { |
120 | d->transaction = std::move(storage().createTransaction(Storage::ReadWrite, [](const Sink::Storage::Error &error) { | 120 | Warning() << "Opened an invalid transaction!!!!!!"; |
121 | Warning() << error.message; | 121 | d->transaction = std::move(storage().createTransaction(Storage::ReadWrite, [](const Sink::Storage::Error &error) { |
122 | })); | 122 | Warning() << error.message; |
123 | })); | ||
124 | } | ||
123 | } | 125 | } |
124 | } | 126 | } |
125 | 127 | ||
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() | |||
207 | Sink::Storage::Transaction transaction; | 207 | Sink::Storage::Transaction transaction; |
208 | { | 208 | { |
209 | Sink::Storage storage(Sink::storageLocation(), mResourceInstanceIdentifier); | 209 | Sink::Storage storage(Sink::storageLocation(), mResourceInstanceIdentifier); |
210 | if (!storage.exists()) { | ||
211 | //This is not an error if the resource wasn't started before | ||
212 | Log() << "Store doesn't exist: " << mResourceInstanceIdentifier; | ||
213 | return Sink::Storage::Transaction(); | ||
214 | } | ||
210 | storage.setDefaultErrorHandler([](const Sink::Storage::Error &error) { Warning() << "Error during query: " << error.store << error.message; }); | 215 | storage.setDefaultErrorHandler([](const Sink::Storage::Error &error) { Warning() << "Error during query: " << error.store << error.message; }); |
211 | transaction = storage.createTransaction(Sink::Storage::ReadOnly); | 216 | transaction = storage.createTransaction(Sink::Storage::ReadOnly); |
212 | } | 217 | } |
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 | |||
524 | list << QByteArray::fromRawData((char *)key.mv_data, key.mv_size); | 524 | list << QByteArray::fromRawData((char *)key.mv_data, key.mv_size); |
525 | } | 525 | } |
526 | } else { | 526 | } else { |
527 | Warning() << "Failed to get a value" << rc; | 527 | //Normal if we don't have any databases yet |
528 | if (rc == MDB_NOTFOUND) { | ||
529 | rc = 0; | ||
530 | } | ||
531 | if (rc) { | ||
532 | Warning() << "Failed to get a value" << rc; | ||
533 | } | ||
528 | } | 534 | } |
529 | } else { | 535 | } else { |
530 | Warning() << "Failed to open db" << rc << QByteArray(mdb_strerror(rc)); | 536 | Warning() << "Failed to open db" << rc << QByteArray(mdb_strerror(rc)); |