Changed getTeamID() to return a string instead of UID as suggested by reviews.

This commit is contained in:
Xin Dong 2020-10-23 10:06:22 -07:00
parent 9b5a02b552
commit 9ef29d0cea
3 changed files with 16 additions and 9 deletions

View File

@ -203,7 +203,7 @@ public:
}
}
UID getTeamID() override { return id; }
std::string getTeamID() override { return id.shortString(); }
virtual vector<StorageServerInterface> getLastKnownServerInterfaces() {
vector<StorageServerInterface> v;
@ -1362,7 +1362,7 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
.detail("Healthy", team->isHealthy())
.detail("TeamSize", team->size())
.detail("MemberIDs", team->getServerIDsStr())
.detail("TeamID", team->getTeamID().shortString());
.detail("TeamID", team->getTeamID());
}
}
@ -2491,7 +2491,7 @@ struct DDTeamCollection : ReferenceCounted<DDTeamCollection> {
TraceEvent("ServerTeamRemoved")
.detail("Primary", primary)
.detail("TeamServerIDs", teams[t]->getServerIDsStr())
.detail("TeamID", teams[t]->getTeamID().shortString());
.detail("TeamID", teams[t]->getTeamID());
// removeTeam also needs to remove the team from the machine team info.
removeTeam(teams[t]);
t--;
@ -2958,7 +2958,7 @@ ACTOR Future<Void> serverTeamRemover(DDTeamCollection* self) {
TraceEvent("ServerTeamRemover", self->distributorId)
.detail("ServerTeamToRemove", st->getServerIDsStr())
.detail("ServerTeamID", st->getTeamID().shortString())
.detail("ServerTeamID", st->getTeamID())
.detail("NumProcessTeamsOnTheServerTeam", maxNumProcessTeams)
.detail("CurrentServerTeams", self->teams.size())
.detail("DesiredServerTeams", desiredServerTeams);
@ -2988,7 +2988,7 @@ ACTOR Future<Void> zeroServerLeftLogger_impl(DDTeamCollection* self, Reference<T
for (auto const& shard : shards) {
sizes.emplace_back(brokenPromiseToNever(self->getShardMetrics.getReply(GetMetricsRequest(shard))));
TraceEvent(SevWarnAlways, "DDShardLost", self->distributorId)
.detail("ServerTeamID", team->getTeamID().shortString())
.detail("ServerTeamID", team->getTeamID())
.detail("ShardBegin", shard.begin)
.detail("ShardEnd", shard.end);
}
@ -3258,7 +3258,7 @@ ACTOR Future<Void> teamTracker(DDTeamCollection* self, Reference<TCTeamInfo> tea
if(logTeamEvents) {
TraceEvent("ServerTeamHealthNotReady", self->distributorId)
.detail("HealthyServerTeamCount", self->healthyTeamCount)
.detail("ServerTeamID", team->getTeamID().shortString());
.detail("ServgetTeamIDerTeamID", team->getTeamID());
}
}
}

View File

@ -59,11 +59,11 @@ struct IDataDistributionTeam {
virtual bool isWrongConfiguration() = 0;
virtual void setWrongConfiguration(bool) = 0;
virtual void addServers(const vector<UID> &servers) = 0;
virtual UID getTeamID() = 0;
virtual std::string getTeamID() = 0;
std::string getDesc() {
const auto& servers = getLastKnownServerInterfaces();
std::string s = format("TeamID:%s", getTeamID().shortString().c_str());
std::string s = format("TeamID:%s", getTeamID().c_str());
s += format("Size %d; ", servers.size());
for(int i=0; i<servers.size(); i++) {
if (i) s += ", ";

View File

@ -254,7 +254,14 @@ public:
teams[0]->addServers(servers);
}
UID getTeamID() override { return id; }
std::string getTeamID() override {
std::string id;
for (int i = 0; i < teams.size(); i++) {
auto const& team = teams[i];
id += (i == teams.size() - 1) ? team->getTeamID() : format("%s, ", team->getTeamID().c_str());
}
return id;
}
};
struct Busyness {