diff --git a/fdbclient/FDBTypes.h b/fdbclient/FDBTypes.h index 741b4c2c81..a60b8ca743 100644 --- a/fdbclient/FDBTypes.h +++ b/fdbclient/FDBTypes.h @@ -74,6 +74,8 @@ struct Tag { int toTagDataIndex() const { return locality >= 0 ? 2 * locality : 1 - (2 * locality); } + bool isNonPrimaryTLogType() const { return locality < 0; } + std::string toString() const { return format("%d:%d", locality, id); } template diff --git a/fdbserver/CommitProxyServer.actor.cpp b/fdbserver/CommitProxyServer.actor.cpp index c3b66a13d5..862ab8b427 100644 --- a/fdbserver/CommitProxyServer.actor.cpp +++ b/fdbserver/CommitProxyServer.actor.cpp @@ -965,7 +965,6 @@ ACTOR Future assignMutationsToStorageServers(CommitBatchContext* self) { if (pProxyCommitData->cacheInfo[m.param1]) { self->toCommit.addTag(cacheTag); } - self->toCommit.saveTags(self->writtenTags); self->toCommit.writeTypedMessage(m); self->toCommit.saveLocations(self->writtenTLogs); } else if (m.type == MutationRef::ClearRange) { @@ -1023,7 +1022,6 @@ ACTOR Future assignMutationsToStorageServers(CommitBatchContext* self) { if (pProxyCommitData->needsCacheTag(clearRange)) { self->toCommit.addTag(cacheTag); } - self->toCommit.saveTags(self->writtenTags); self->toCommit.writeTypedMessage(m); self->toCommit.saveLocations(self->writtenTLogs); } else { @@ -1115,6 +1113,8 @@ ACTOR Future postResolution(CommitBatchContext* self) { // Second pass wait(assignMutationsToStorageServers(self)); + self->toCommit.saveTags(self->writtenTags); + // Obtain previous committed versions for each affected tlog from sequencer if (SERVER_KNOBS->ENABLE_VERSION_VECTOR) { wait(getTPCV(self)); diff --git a/fdbserver/LogSystem.h b/fdbserver/LogSystem.h index 8d979f80a9..96c9d32462 100644 --- a/fdbserver/LogSystem.h +++ b/fdbserver/LogSystem.h @@ -996,9 +996,13 @@ struct LogPushData : NonCopyable { writtenLocations.clear(); } - // copy next_message_tags into given set - void saveTags(std::set& writtenTags) { - writtenTags.insert(next_message_tags.begin(), next_message_tags.end()); + // copy written_tags, after filtering, into given set + void saveTags(std::set& filteredTags) const { + for (const auto& tag : written_tags) { + if (!tag.isNonPrimaryTLogType()) { + filteredTags.insert(tag); + } + } } // store tlogs as represented by index @@ -1017,6 +1021,7 @@ struct LogPushData : NonCopyable { } msg_locations.clear(); logSystem->getPushLocations(prev_tags, msg_locations); + written_tags.insert(next_message_tags.begin(), next_message_tags.end()); next_message_tags.clear(); } uint32_t subseq = this->subsequence++; @@ -1095,6 +1100,7 @@ struct LogPushData : NonCopyable { wr.serializeBytes((uint8_t*)from.getData() + firstOffset, firstLength); } } + written_tags.insert(next_message_tags.begin(), next_message_tags.end()); next_message_tags.clear(); } @@ -1104,6 +1110,7 @@ private: Reference logSystem; std::vector next_message_tags; std::vector prev_tags; + std::set written_tags; std::vector messagesWriter; std::vector msg_locations; // Stores message locations that have had span information written to them