From 5ac4de87753c9d2d2f3db85ddfe663258fe2e2de Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Thu, 13 Jul 2017 16:31:55 -0700 Subject: [PATCH] fix: the same tag could be in the server tags list twice --- fdbserver/ApplyMetadataMutation.h | 11 +++++++---- fdbserver/LogSystem.h | 2 +- fdbserver/TagPartitionedLogSystem.actor.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fdbserver/ApplyMetadataMutation.h b/fdbserver/ApplyMetadataMutation.h index 1fc6a29154..03c0b754a1 100644 --- a/fdbserver/ApplyMetadataMutation.h +++ b/fdbserver/ApplyMetadataMutation.h @@ -202,17 +202,20 @@ static void applyMetadataMutations(UID const& dbgid, Arena &arena, VectorRefreadRange(serverTagKeys).get(); + std::set 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); } } diff --git a/fdbserver/LogSystem.h b/fdbserver/LogSystem.h index 78ae8d8c5f..d0109ba3a7 100644 --- a/fdbserver/LogSystem.h +++ b/fdbserver/LogSystem.h @@ -498,7 +498,7 @@ struct ILogSystem { virtual void getPushLocations( std::vector const& tags, vector& locations ) = 0; - virtual void addRemoteTags( int logSet, std::vector originalTags, std::vector& tags ) = 0; + virtual void addRemoteTags( int logSet, std::vector const& originalTags, std::vector& tags ) = 0; virtual Tag getRandomRouterTag() = 0; diff --git a/fdbserver/TagPartitionedLogSystem.actor.cpp b/fdbserver/TagPartitionedLogSystem.actor.cpp index b95ce49f49..4ea512dab1 100644 --- a/fdbserver/TagPartitionedLogSystem.actor.cpp +++ b/fdbserver/TagPartitionedLogSystem.actor.cpp @@ -546,7 +546,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted::max(); } - virtual void addRemoteTags( int logSet, std::vector originalTags, std::vector& tags ) { + virtual void addRemoteTags( int logSet, std::vector const& originalTags, std::vector& tags ) { tLogs[logSet]->getPushLocations(originalTags, tags, SERVER_KNOBS->MAX_TAG); }