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
1 change: 1 addition & 0 deletions fdbclient/ServerKnobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE, 0.001 ); if( isSimulated ) SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE = deterministicRandom()->random01();
init( SHARDED_ROCKSDB_USE_DIRECT_IO, false ); if (isSimulated) SHARDED_ROCKSDB_USE_DIRECT_IO = deterministicRandom()->coinflip();
init( SHARDED_ROCKSDB_FLUSH_PERIOD, 0.0 ); if (isSimulated) SHARDED_ROCKSDB_FLUSH_PERIOD = deterministicRandom()->randomInt(100, 1000);
init( SHARDED_ROCKSDB_DETAILED_STATS, false ); if (isSimulated) SHARDED_ROCKSDB_DETAILED_STATS = deterministicRandom()->coinflip();


// Leader election
Expand Down
1 change: 1 addition & 0 deletions fdbclient/include/fdbclient/ServerKnobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ class ServerKnobs : public KnobsImpl<ServerKnobs> {
double SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE;
bool SHARDED_ROCKSDB_USE_DIRECT_IO;
double SHARDED_ROCKSDB_FLUSH_PERIOD;
bool SHARDED_ROCKSDB_DETAILED_STATS;

// Leader election
int MAX_NOTIFICATIONS;
Expand Down
3 changes: 3 additions & 0 deletions fdbserver/DDTeamCollection.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3639,6 +3639,8 @@ class DDTeamCollectionImpl {
}
}

self->shardsAffectedByTeamFailure->traceTeamShardMapping();

// TODO: re-enable the following logging or remove them.
// TraceEvent("LocalityRecordKeyName", self->getDistributorId())
// .detail("Size", internedLocalityRecordKeyNameStrings.size())
Expand Down Expand Up @@ -4942,6 +4944,7 @@ void DDTeamCollection::traceAllInfo(bool shouldPrint) const {
traceMachineTeamInfo();
traceLocalityArrayIndexName();
traceMachineLocalityMap();
shardsAffectedByTeamFailure->traceTeamShardMapping();
}

void DDTeamCollection::rebuildMachineLocalityMap() {
Expand Down
18 changes: 12 additions & 6 deletions fdbserver/KeyValueStoreShardedRocksDB.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,12 +1298,18 @@ class ShardManager {
int numLevels = 0;
for (auto it = cfMetadata.levels.begin(); it != cfMetadata.levels.end(); ++it) {
std::string propValue = "";
ASSERT(shard->db->GetProperty(shard->cf,
rocksdb::DB::Properties::kCompressionRatioAtLevelPrefix +
std::to_string(it->level),
&propValue));
e.detail("Level" + std::to_string(it->level),
std::to_string(it->size) + " " + propValue + " " + std::to_string(it->files.size()));
if (SERVER_KNOBS->SHARDED_ROCKSDB_DETAILED_STATS) {
ASSERT(shard->db->GetProperty(shard->cf,
rocksdb::DB::Properties::kCompressionRatioAtLevelPrefix +
std::to_string(it->level),
&propValue));
e.detail("Level" + std::to_string(it->level),
std::to_string(it->size) + " " + propValue + " " +
std::to_string(it->files.size()));
}
if (it->level == 0) {
e.detail("Level0Files", it->files.size());
}
if (it->size > 0) {
++numLevels;
}
Expand Down
28 changes: 28 additions & 0 deletions fdbserver/ShardsAffectedByTeamFailure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,34 @@ void ShardsAffectedByTeamFailure::setCheckMode(CheckMode mode) {
checkMode = mode;
}

void ShardsAffectedByTeamFailure::traceTeamShardMapping() const {
Team prevTeam;
int count = 0;
int teamCount;
for (auto it = team_shards.begin(); it != team_shards.end(); ++it) {
if (it->first != prevTeam) {
if (count > 0) {
TraceEvent("DDTeamShardCount")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many events will be emitted?

.detail("IsPrimary", prevTeam.primary)
.detail("Team", prevTeam.toString())
.detail("Shards", count);
}
count = 1;
prevTeam = it->first;
++teamCount;
} else {
++count;
}
}
if (count > 0) {
TraceEvent("DDTeamShardCount")
.detail("IsPrimary", prevTeam.primary)
.detail("Team", prevTeam.toString())
.detail("Shards", count);
}
TraceEvent("DDTeamShardStats").detail("TotalShards", team_shards.size()).detail("TotalTeams", teamCount);
}

void ShardsAffectedByTeamFailure::check() const {
if (checkMode == CheckMode::ForceNoCheck)
return;
Expand Down
2 changes: 2 additions & 0 deletions fdbserver/include/fdbserver/ShardsAffectedByTeamFailure.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class ShardsAffectedByTeamFailure : public ReferenceCounted<ShardsAffectedByTeam
void assignRangeToTeams(KeyRangeRef keys, const std::vector<Team>& destinationTeam);
void check() const;
void setCheckMode(CheckMode);
// Prints the team shard mapping as trace events.
void traceTeamShardMapping() const;

PromiseStream<KeyRange> restartShardTracker;

Expand Down