Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions fdbserver/datadistributor/DDTeamCollection.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "fdbserver/core/Knobs.h"
#include "fdbserver/datadistributor/DDTeamCollection.h"
#include "fdbserver/datadistributor/DataDistributionTeam.h"
#include "TCInfo.h"
#include "ExclusionTracker.h"
#include "flow/IRandom.h"
#include "flow/Trace.h"
Expand Down Expand Up @@ -815,7 +816,7 @@ class DDTeamCollectionImpl {
serverIds.push_back(*tempMap->getObject(it));
}
std::sort(serverIds.begin(), serverIds.end());
self->addTeam(serverIds.begin(), serverIds.end(), IsInitialTeam::True);
self->addTeam(serverIds, IsInitialTeam::True);
}
} else {
serverIds.clear();
Expand Down Expand Up @@ -864,7 +865,7 @@ class DDTeamCollectionImpl {
std::set<std::vector<UID>>::iterator teamIterEnd =
self->primary ? initTeams->primaryTeams.end() : initTeams->remoteTeams.end();
for (; teamIter != teamIterEnd; ++teamIter) {
self->addTeam(teamIter->begin(), teamIter->end(), IsInitialTeam::True);
self->addTeam(*teamIter, IsInitialTeam::True);
co_await yield();
}
}
Expand Down Expand Up @@ -4922,6 +4923,21 @@ Reference<TCTeamInfo> DDTeamCollection::buildLargeTeam(int teamSize) {
return teamInfo;
}

void DDTeamCollection::addTeam(std::vector<UID> const& team, IsInitialTeam isInitialTeam) {
std::vector<Reference<TCServerInfo>> newTeamServers;
for (auto const& serverID : team) {
if (auto server = server_info.find(serverID); server != server_info.end()) {
newTeamServers.push_back(server->second);
}
}

addTeam(newTeamServers, isInitialTeam);
}

void DDTeamCollection::addTeam(std::set<UID> const& team, IsInitialTeam isInitialTeam) {
addTeam(std::vector<UID>(team.begin(), team.end()), isInitialTeam);
}

void DDTeamCollection::addTeam(const std::vector<Reference<TCServerInfo>>& newTeamServers,
IsInitialTeam isInitialTeam,
IsRedundantTeam redundantTeam) {
Expand Down Expand Up @@ -5709,7 +5725,7 @@ int DDTeamCollection::addTeamsBestOf(int teamsToBuild, int desiredTeams, int max
}

// Step 4: Add the server team
addTeam(bestServerTeam.begin(), bestServerTeam.end(), IsInitialTeam::False);
addTeam(bestServerTeam, IsInitialTeam::False);
addedTeams++;
}

Expand Down
2 changes: 1 addition & 1 deletion fdbserver/datadistributor/TCInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "fdbserver/core/Knobs.h"
#include "fdbserver/datadistributor/DDTeamCollection.h"
#include "fdbserver/datadistributor/TCInfo.h"
#include "TCInfo.h"
#include "flow/CoroUtils.h"

class TCServerInfoImpl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include "fdbserver/core/MoveKeys.h"
#include "fdbserver/core/TLogInterface.h"
#include "fdbserver/core/WaitFailure.h"
#include "fdbserver/datadistributor/TCInfo.h"
#include "fdbserver/datadistributor/DataDistribution.h"
#include "fdbserver/datadistributor/DataDistributionTeam.h"
#include "fdbserver/core/QuietDatabase.h"
#include "fdbserver/core/ServerDBInfo.h"
#include "flow/ActorCollection.h"
Expand All @@ -46,6 +46,7 @@
#include "flow/Trace.h"
#include "flow/UnitTest.h"

class TCServerInfo;
class TCTeamInfo;
class TCMachineInfo;
class TCMachineTeamInfo;
Expand Down Expand Up @@ -625,33 +626,18 @@ class DDTeamCollection : public ReferenceCounted<DDTeamCollection> {

void setCheckTeamDelay() { this->checkTeamDelay = Void(); }

// Assume begin to end is sorted by std::sort
// Assume InputIt is iterator to UID
// Assume team is sorted by std::sort
// Note: We must allow creating empty teams because empty team is created when a remote DB is initialized.
// The empty team is used as the starting point to move data to the remote DB
// begin : the start of the team member ID
// end : end of the team member ID
// isIntialTeam : False when the team is added by addTeamsBestOf(); True otherwise, e.g.,
// when the team added at init() when we recreate teams by looking up DB
template <class InputIt>
void addTeam(InputIt begin, InputIt end, IsInitialTeam isInitialTeam) {
std::vector<Reference<TCServerInfo>> newTeamServers;
for (auto i = begin; i != end; ++i) {
if (server_info.find(*i) != server_info.end()) {
newTeamServers.push_back(server_info[*i]);
}
}

addTeam(newTeamServers, isInitialTeam);
}
void addTeam(std::vector<UID> const& team, IsInitialTeam isInitialTeam);

void addTeam(const std::vector<Reference<TCServerInfo>>& newTeamServers,
IsInitialTeam,
IsRedundantTeam = IsRedundantTeam::False);

void addTeam(std::set<UID> const& team, IsInitialTeam isInitialTeam) {
addTeam(team.begin(), team.end(), isInitialTeam);
}
void addTeam(std::set<UID> const& team, IsInitialTeam isInitialTeam);

// Create server teams based on machine teams
// Before the number of machine teams reaches the threshold, build a machine team for each server team
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "fdbclient/RunRYWTransaction.h"
#include "fdbserver/datadistributor/DDTxnProcessor.h"
#include "fdbserver/datadistributor/ShardsAffectedByTeamFailure.h"
#include "fdbserver/datadistributor/TCInfo.h"
#include "fdbserver/datadistributor/DataDistributionTeam.h"
#include "fdbclient/StorageWiggleMetrics.h"
#include "fdbclient/DataDistributionConfig.h"
#include <boost/heap/policies.hpp>
Expand Down
Loading