diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-18 11:20:40 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-18 11:20:40 +0200 |
commit | 4cb1c1e6103459e54d931b8672674f5f49f8ac2f (patch) | |
tree | fc967b152becd2f6c61055e0d5aab1c31dc4a78f /common/synchronizer.cpp | |
parent | 2485dbb0f287d93061bc5098a8e11358d3d0d6f9 (diff) | |
download | sink-4cb1c1e6103459e54d931b8672674f5f49f8ac2f.tar.gz sink-4cb1c1e6103459e54d931b8672674f5f49f8ac2f.zip |
Skip change-replay for already removed entites.
This is required to be able to resolve change-replay failures by
removing the entity.
Diffstat (limited to 'common/synchronizer.cpp')
-rw-r--r-- | common/synchronizer.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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<void> Synchronizer::replay(const QByteArray &type, const QByteArray | |||
626 | } | 626 | } |
627 | SinkLogCtx(mLogCtx) << "Replaying: " << key << "Type: " << type << "Uid: " << uid << "Rid: " << oldRemoteId << "Revision: " << metadataBuffer->revision(); | 627 | SinkLogCtx(mLogCtx) << "Replaying: " << key << "Type: " << type << "Uid: " << uid << "Rid: " << oldRemoteId << "Revision: " << metadataBuffer->revision(); |
628 | 628 | ||
629 | //If the entity has been removed already and this is not the removal, skip over. | ||
630 | //This is important so we can unblock changereplay by removing entities. | ||
631 | bool skipOver = false; | ||
632 | store().readLatest(type, uid, [&](const ApplicationDomain::ApplicationDomainType &, Sink::Operation latestOperation) { | ||
633 | if (latestOperation == Sink::Operation_Removal && operation != Sink::Operation_Removal) { | ||
634 | skipOver = true; | ||
635 | } | ||
636 | }); | ||
637 | if (skipOver) { | ||
638 | SinkLogCtx(mLogCtx) << "Skipping over already removed entity"; | ||
639 | return KAsync::null(); | ||
640 | } | ||
641 | |||
629 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); | 642 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); |
630 | //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? | 643 | //TODO This requires supporting every domain type here as well. Can we solve this better so we can do the dispatch somewhere centrally? |
631 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { | 644 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { |