fix: the same tag could be in the server tags list twice

This commit is contained in:
Evan Tschannen 2017-07-13 16:31:55 -07:00
parent 57ba9d36af
commit 5ac4de8775
3 changed files with 9 additions and 6 deletions

View File

@ -202,17 +202,20 @@ static void applyMetadataMutations(UID const& dbgid, Arena &arena, VectorRef<Mut
if(toCommit) {
// Notifies all servers that a Master's server epoch ends
auto allServers = txnStateStore->readRange(serverTagKeys).get();
std::set<Tag> allTags;
for (auto &kv : allServers)
allTags.insert(decodeServerTagValue(kv.value));
if (m.param1 == lastEpochEndKey) {
for (auto &kv : allServers)
toCommit->addTag(decodeServerTagValue(kv.value));
for (auto t : allTags)
toCommit->addTag(t);
toCommit->addTypedMessage(LogProtocolMessage());
}
MutationRef privatized = m;
privatized.param1 = m.param1.withPrefix(systemKeys.begin, arena);
for (auto &kv : allServers)
toCommit->addTag(decodeServerTagValue(kv.value));
for (auto t : allTags)
toCommit->addTag(t);
toCommit->addTypedMessage(privatized);
}
}

View File

@ -498,7 +498,7 @@ struct ILogSystem {
virtual void getPushLocations( std::vector<Tag> const& tags, vector<int>& locations ) = 0;
virtual void addRemoteTags( int logSet, std::vector<Tag> originalTags, std::vector<int>& tags ) = 0;
virtual void addRemoteTags( int logSet, std::vector<Tag> const& originalTags, std::vector<int>& tags ) = 0;
virtual Tag getRandomRouterTag() = 0;

View File

@ -546,7 +546,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
return std::numeric_limits<Version>::max();
}
virtual void addRemoteTags( int logSet, std::vector<Tag> originalTags, std::vector<int>& tags ) {
virtual void addRemoteTags( int logSet, std::vector<Tag> const& originalTags, std::vector<int>& tags ) {
tLogs[logSet]->getPushLocations(originalTags, tags, SERVER_KNOBS->MAX_TAG);
}