From 4cb1c1e6103459e54d931b8672674f5f49f8ac2f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 18 May 2018 11:20:40 +0200 Subject: Skip change-replay for already removed entites. This is required to be able to resolve change-replay failures by removing the entity. --- common/synchronizer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common') diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 51e53c8..037a01f 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -626,6 +626,19 @@ KAsync::Job Synchronizer::replay(const QByteArray &type, const QByteArray } SinkLogCtx(mLogCtx) << "Replaying: " << key << "Type: " << type << "Uid: " << uid << "Rid: " << oldRemoteId << "Revision: " << metadataBuffer->revision(); + //If the entity has been removed already and this is not the removal, skip over. + //This is important so we can unblock changereplay by removing entities. + bool skipOver = false; + store().readLatest(type, uid, [&](const ApplicationDomain::ApplicationDomainType &, Sink::Operation latestOperation) { + if (latestOperation == Sink::Operation_Removal && operation != Sink::Operation_Removal) { + skipOver = true; + } + }); + if (skipOver) { + SinkLogCtx(mLogCtx) << "Skipping over already removed entity"; + return KAsync::null(); + } + KAsync::Job job = KAsync::null(); //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? if (type == ApplicationDomain::getTypeName()) { -- cgit v1.2.3