summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-18 14:18:00 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-18 14:18:00 +0200
commit1ff4456e5dc2b9a9dfa80047f9e5a4a9e1395cdf (patch)
treed960c61571be404d18c72d6c21c4d1de5b8a1f33
parentbdf8ada25760ca9f4054d9ac719c703ce8abc300 (diff)
downloadsink-1ff4456e5dc2b9a9dfa80047f9e5a4a9e1395cdf.tar.gz
sink-1ff4456e5dc2b9a9dfa80047f9e5a4a9e1395cdf.zip
Debug output
-rw-r--r--common/datastorequery.cpp5
-rw-r--r--common/typeindex.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp
index f1b0ed2..12c0ae1 100644
--- a/common/datastorequery.cpp
+++ b/common/datastorequery.cpp
@@ -232,6 +232,7 @@ public:
232 232
233 void updateComplete() Q_DECL_OVERRIDE 233 void updateComplete() Q_DECL_OVERRIDE
234 { 234 {
235 SinkTraceCtx(mDatastore->mLogCtx) << "Reduction update is complete.";
235 mIncrementallyReducedValues.clear(); 236 mIncrementallyReducedValues.clear();
236 } 237 }
237 238
@@ -317,6 +318,7 @@ public:
317 } 318 }
318 }(); 319 }();
319 if (reductionValue.isNull()) { 320 if (reductionValue.isNull()) {
321 SinkTraceCtx(mDatastore->mLogCtx) << "No reduction value: " << result.entity.identifier();
320 //We failed to find a value to reduce on, so ignore this entity. 322 //We failed to find a value to reduce on, so ignore this entity.
321 //Can happen if the entity was already removed and we have no previous revision. 323 //Can happen if the entity was already removed and we have no previous revision.
322 return; 324 return;
@@ -325,6 +327,7 @@ public:
325 if (!mReducedValues.contains(reductionValueBa)) { 327 if (!mReducedValues.contains(reductionValueBa)) {
326 //Only reduce every value once. 328 //Only reduce every value once.
327 mReducedValues.insert(reductionValueBa); 329 mReducedValues.insert(reductionValueBa);
330 SinkTraceCtx(mDatastore->mLogCtx) << "Reducing new value: " << result.entity.identifier() << reductionValueBa;
328 auto reductionResult = reduceOnValue(reductionValue); 331 auto reductionResult = reduceOnValue(reductionValue);
329 332
330 //This can happen if we get a removal message from a filtered entity and all entites of the reduction are filtered. 333 //This can happen if we get a removal message from a filtered entity and all entites of the reduction are filtered.
@@ -341,11 +344,13 @@ public:
341 //During updates adjust the reduction according to the modification/addition or removal 344 //During updates adjust the reduction according to the modification/addition or removal
342 //We have to redo the reduction for every element, because of the aggregation values. 345 //We have to redo the reduction for every element, because of the aggregation values.
343 if (mIncremental && !mIncrementallyReducedValues.contains(reductionValueBa)) { 346 if (mIncremental && !mIncrementallyReducedValues.contains(reductionValueBa)) {
347 SinkTraceCtx(mDatastore->mLogCtx) << "Incremental reduction update: " << result.entity.identifier() << reductionValueBa;
344 mIncrementallyReducedValues.insert(reductionValueBa); 348 mIncrementallyReducedValues.insert(reductionValueBa);
345 //Redo the reduction to find new aggregated values 349 //Redo the reduction to find new aggregated values
346 auto selectionResult = reduceOnValue(reductionValue); 350 auto selectionResult = reduceOnValue(reductionValue);
347 351
348 auto oldSelectionResult = mSelectedValues.take(reductionValueBa); 352 auto oldSelectionResult = mSelectedValues.take(reductionValueBa);
353 SinkTraceCtx(mDatastore->mLogCtx) << "Old selection result: " << oldSelectionResult << " New selection result: " << selectionResult.selection;
349 //If mSelectedValues did not containthe value, oldSelectionResult will be empty.(Happens if entites have been filtered) 354 //If mSelectedValues did not containthe value, oldSelectionResult will be empty.(Happens if entites have been filtered)
350 if (oldSelectionResult.isEmpty()) { 355 if (oldSelectionResult.isEmpty()) {
351 return; 356 return;
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index a111134..41821cb 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -380,7 +380,7 @@ QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant
380 const auto lookupKey = getByteArray(value); 380 const auto lookupKey = getByteArray(value);
381 index.lookup( 381 index.lookup(
382 lookupKey, [&](const QByteArray &value) { secondaryKeys << value; }, [property](const Index::Error &error) { SinkWarning() << "Error in index: " << error.message << property; }); 382 lookupKey, [&](const QByteArray &value) { secondaryKeys << value; }, [property](const Index::Error &error) { SinkWarning() << "Error in index: " << error.message << property; });
383 SinkTraceCtx(mLogCtx) << "Looked up secondary keys: " << secondaryKeys; 383 SinkTraceCtx(mLogCtx) << "Looked up secondary keys for the following lookup key: " << lookupKey << " => " << secondaryKeys;
384 for (const auto &secondary : secondaryKeys) { 384 for (const auto &secondary : secondaryKeys) {
385 keys += lookup(resultProperty, secondary, transaction); 385 keys += lookup(resultProperty, secondary, transaction);
386 } 386 }