summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r--common/queryrunner.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index 27ff476..ea17176 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -147,7 +147,9 @@ typename Sink::ResultEmitter<typename DomainType::Ptr>::Ptr QueryRunner<DomainTy
147static inline ResultSet fullScan(const Sink::Storage::Transaction &transaction, const QByteArray &bufferType) 147static inline ResultSet fullScan(const Sink::Storage::Transaction &transaction, const QByteArray &bufferType)
148{ 148{
149 // TODO use a result set with an iterator, to read values on demand 149 // TODO use a result set with an iterator, to read values on demand
150 QVector<QByteArray> keys; 150 Trace() << "Looking for : " << bufferType;
151 //The scan can return duplicate results if we have multiple revisions, so we use a set to deduplicate.
152 QSet<QByteArray> keys;
151 Storage::mainDatabase(transaction, bufferType) 153 Storage::mainDatabase(transaction, bufferType)
152 .scan(QByteArray(), 154 .scan(QByteArray(),
153 [&](const QByteArray &key, const QByteArray &value) -> bool { 155 [&](const QByteArray &key, const QByteArray &value) -> bool {
@@ -155,13 +157,17 @@ static inline ResultSet fullScan(const Sink::Storage::Transaction &transaction,
155 if (Sink::Storage::isInternalKey(key)) { 157 if (Sink::Storage::isInternalKey(key)) {
156 return true; 158 return true;
157 } 159 }
160 if (keys.contains(Sink::Storage::uidFromKey(key))) {
161 //Not something that should persist if the replay works, so we keep a message for now.
162 Trace() << "Multiple revisions for key: " << key;
163 }
158 keys << Sink::Storage::uidFromKey(key); 164 keys << Sink::Storage::uidFromKey(key);
159 return true; 165 return true;
160 }, 166 },
161 [](const Sink::Storage::Error &error) { Warning() << "Error during query: " << error.message; }); 167 [](const Sink::Storage::Error &error) { Warning() << "Error during query: " << error.message; });
162 168
163 Trace() << "Full scan retrieved " << keys.size() << " results."; 169 Trace() << "Full scan retrieved " << keys.size() << " results.";
164 return ResultSet(keys); 170 return ResultSet(keys.toList().toVector());
165} 171}
166 172
167 173