From bc7b76b40757474f1c6d70a9b80a823944ff0a0c Mon Sep 17 00:00:00 2001 From: Josh Slocum Date: Thu, 27 Jan 2022 14:25:08 -0600 Subject: [PATCH] Fix for gotAll in getChangeFeedMutations --- fdbclient/NativeAPI.actor.cpp | 14 ++++++++++++-- fdbserver/storageserver.actor.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 9d5fb8ab62..71ceae180a 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -7389,12 +7389,22 @@ ACTOR Future partialChangeFeedStream(StorageServerInterface interf, } else { // TODO REMOVE eventually, useful for debugging for now if (!rep.mutations[resultLoc].mutations.empty()) { - fmt::print("non-empty mutations ({0}), but versions out of order from {1}! mv={2}, " - "nv={3}\n", + fmt::print("non-empty mutations ({0}), but versions out of order from {1} for {2} cf " + "{3}! mv={4}, nv={5}\n", rep.mutations.size(), interf.id().toString().substr(0, 4), + idx, + feedData->id.toString().substr(0, 6), rep.mutations[resultLoc].version, nextVersion); + for (auto& it : rep.mutations[resultLoc].mutations) { + if (it.type == MutationRef::SetValue) { + printf(" %s=", it.param1.printable().c_str()); + } else { + printf( + " %s - %s", it.param1.printable().c_str(), it.param2.printable().c_str()); + } + } } ASSERT(rep.mutations[resultLoc].mutations.empty()); } diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index 8be69f878d..1691eb363d 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -1901,8 +1901,10 @@ ACTOR Future> getChangeFeedMutations(Stor } reply.mutations.push_back( reply.arena, MutationsAndVersionRef(finalVersion, finalVersion == dequeVersion ? dequeKnownCommit : 0)); - // if we add empty mutation, we gotAll - gotAll = true; + // if we add empty mutation after the last thing in memory, and didn't read from disk, gotAll is true + if (data->version.get() == startVersion) { + gotAll = true; + } } if (MUTATION_TRACKING_ENABLED) {