Fix for gotAll in getChangeFeedMutations

This commit is contained in:
Josh Slocum 2022-01-27 14:25:08 -06:00
parent bf6ed8348f
commit bc7b76b407
2 changed files with 16 additions and 4 deletions

View File

@ -7389,12 +7389,22 @@ ACTOR Future<Void> partialChangeFeedStream(StorageServerInterface interf,
} else { } else {
// TODO REMOVE eventually, useful for debugging for now // TODO REMOVE eventually, useful for debugging for now
if (!rep.mutations[resultLoc].mutations.empty()) { if (!rep.mutations[resultLoc].mutations.empty()) {
fmt::print("non-empty mutations ({0}), but versions out of order from {1}! mv={2}, " fmt::print("non-empty mutations ({0}), but versions out of order from {1} for {2} cf "
"nv={3}\n", "{3}! mv={4}, nv={5}\n",
rep.mutations.size(), rep.mutations.size(),
interf.id().toString().substr(0, 4), interf.id().toString().substr(0, 4),
idx,
feedData->id.toString().substr(0, 6),
rep.mutations[resultLoc].version, rep.mutations[resultLoc].version,
nextVersion); 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()); ASSERT(rep.mutations[resultLoc].mutations.empty());
} }

View File

@ -1901,8 +1901,10 @@ ACTOR Future<std::pair<ChangeFeedStreamReply, bool>> getChangeFeedMutations(Stor
} }
reply.mutations.push_back( reply.mutations.push_back(
reply.arena, MutationsAndVersionRef(finalVersion, finalVersion == dequeVersion ? dequeKnownCommit : 0)); reply.arena, MutationsAndVersionRef(finalVersion, finalVersion == dequeVersion ? dequeKnownCommit : 0));
// if we add empty mutation, we gotAll // if we add empty mutation after the last thing in memory, and didn't read from disk, gotAll is true
gotAll = true; if (data->version.get() == startVersion) {
gotAll = true;
}
} }
if (MUTATION_TRACKING_ENABLED) { if (MUTATION_TRACKING_ENABLED) {