summaryrefslogtreecommitdiffstats
path: root/common/changereplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/changereplay.cpp')
-rw-r--r--common/changereplay.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/changereplay.cpp b/common/changereplay.cpp
index 5817e8d..d7f46dc 100644
--- a/common/changereplay.cpp
+++ b/common/changereplay.cpp
@@ -115,10 +115,12 @@ KAsync::Job<void> ChangeReplay::replayNextRevision()
115 SinkErrorCtx(mLogCtx) << "Failed to read uid or type for revison: " << revision << uid << type; 115 SinkErrorCtx(mLogCtx) << "Failed to read uid or type for revison: " << revision << uid << type;
116 } else { 116 } else {
117 // TODO: should not use internal representations 117 // TODO: should not use internal representations
118 const auto key = Storage::Key(Storage::Identifier::fromDisplayByteArray(uid), revision).toInternalByteArray(); 118 const auto key = Storage::Key(Storage::Identifier::fromDisplayByteArray(uid), revision);
119 const auto internalKey = key.toInternalByteArray();
120 const auto displayKey = key.toDisplayByteArray();
119 QByteArray entityBuffer; 121 QByteArray entityBuffer;
120 DataStore::mainDatabase(mMainStoreTransaction, type) 122 DataStore::mainDatabase(mMainStoreTransaction, type)
121 .scan(key, 123 .scan(internalKey,
122 [&entityBuffer](const QByteArray &key, const QByteArray &value) -> bool { 124 [&entityBuffer](const QByteArray &key, const QByteArray &value) -> bool {
123 entityBuffer = value; 125 entityBuffer = value;
124 return false; 126 return false;
@@ -128,9 +130,9 @@ KAsync::Job<void> ChangeReplay::replayNextRevision()
128 if (entityBuffer.isEmpty()) { 130 if (entityBuffer.isEmpty()) {
129 SinkErrorCtx(mLogCtx) << "Failed to replay change " << key; 131 SinkErrorCtx(mLogCtx) << "Failed to replay change " << key;
130 } else { 132 } else {
131 if (canReplay(type, key, entityBuffer)) { 133 if (canReplay(type, displayKey, entityBuffer)) {
132 SinkTraceCtx(mLogCtx) << "Replaying " << key; 134 SinkTraceCtx(mLogCtx) << "Replaying " << displayKey;
133 replayJob = replay(type, key, entityBuffer); 135 replayJob = replay(type, displayKey, entityBuffer);
134 //Set the last revision we tried to replay 136 //Set the last revision we tried to replay
135 *lastReplayedRevision = revision; 137 *lastReplayedRevision = revision;
136 //Execute replay job and commit 138 //Execute replay job and commit