Merge with upstream tcinfo refactor and move the server knob init to be adjacent to related knobs

This commit is contained in:
Bharadwaj V.R 2022-02-16 10:28:55 -08:00
parent cb5f44c76d
commit 3fe6a952f1
3 changed files with 5 additions and 5 deletions

View File

@ -233,6 +233,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( STORAGE_METRICS_POLLING_DELAY, 2.0 ); if( randomize && BUGGIFY ) STORAGE_METRICS_POLLING_DELAY = 15.0; init( STORAGE_METRICS_POLLING_DELAY, 2.0 ); if( randomize && BUGGIFY ) STORAGE_METRICS_POLLING_DELAY = 15.0;
init( STORAGE_METRICS_RANDOM_DELAY, 0.2 ); init( STORAGE_METRICS_RANDOM_DELAY, 0.2 );
init( AVAILABLE_SPACE_RATIO_CUTOFF, 0.05 ); init( AVAILABLE_SPACE_RATIO_CUTOFF, 0.05 );
init( AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER, 0.03 );
init( DESIRED_TEAMS_PER_SERVER, 5 ); if( randomize && BUGGIFY ) DESIRED_TEAMS_PER_SERVER = deterministicRandom()->randomInt(1, 10); init( DESIRED_TEAMS_PER_SERVER, 5 ); if( randomize && BUGGIFY ) DESIRED_TEAMS_PER_SERVER = deterministicRandom()->randomInt(1, 10);
init( MAX_TEAMS_PER_SERVER, 5*DESIRED_TEAMS_PER_SERVER ); init( MAX_TEAMS_PER_SERVER, 5*DESIRED_TEAMS_PER_SERVER );
init( DD_SHARD_SIZE_GRANULARITY, 5000000 ); init( DD_SHARD_SIZE_GRANULARITY, 5000000 );
@ -579,7 +580,6 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
init( MIN_AVAILABLE_SPACE, 1e8 ); init( MIN_AVAILABLE_SPACE, 1e8 );
init( MIN_AVAILABLE_SPACE_RATIO, 0.05 ); init( MIN_AVAILABLE_SPACE_RATIO, 0.05 );
init( AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER, 0.03 );
init( TARGET_AVAILABLE_SPACE_RATIO, 0.30 ); init( TARGET_AVAILABLE_SPACE_RATIO, 0.30 );
init( AVAILABLE_SPACE_UPDATE_DELAY, 5.0 ); init( AVAILABLE_SPACE_UPDATE_DELAY, 5.0 );

View File

@ -185,6 +185,7 @@ public:
double STORAGE_METRICS_POLLING_DELAY; double STORAGE_METRICS_POLLING_DELAY;
double STORAGE_METRICS_RANDOM_DELAY; double STORAGE_METRICS_RANDOM_DELAY;
double AVAILABLE_SPACE_RATIO_CUTOFF; double AVAILABLE_SPACE_RATIO_CUTOFF;
double AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER;
int DESIRED_TEAMS_PER_SERVER; int DESIRED_TEAMS_PER_SERVER;
int MAX_TEAMS_PER_SERVER; int MAX_TEAMS_PER_SERVER;
int64_t DD_SHARD_SIZE_GRANULARITY; int64_t DD_SHARD_SIZE_GRANULARITY;
@ -525,7 +526,6 @@ public:
int64_t MIN_AVAILABLE_SPACE; int64_t MIN_AVAILABLE_SPACE;
double MIN_AVAILABLE_SPACE_RATIO; double MIN_AVAILABLE_SPACE_RATIO;
double AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER;
double TARGET_AVAILABLE_SPACE_RATIO; double TARGET_AVAILABLE_SPACE_RATIO;
double AVAILABLE_SPACE_UPDATE_DELAY; double AVAILABLE_SPACE_UPDATE_DELAY;

View File

@ -138,9 +138,9 @@ TCServerInfo::TCServerInfo(StorageServerInterface ssi,
} }
bool TCServerInfo::hasHealthyAvailableSpace(double minAvailableSpaceRatio) const { bool TCServerInfo::hasHealthyAvailableSpace(double minAvailableSpaceRatio) const {
ASSERT(serverMetrics.present()); ASSERT(serverMetricsPresent());
auto& metrics = serverMetrics.get(); auto& metrics = getServerMetrics();
ASSERT(metrics.available.bytes >= 0); ASSERT(metrics.available.bytes >= 0);
ASSERT(metrics.capacity.bytes >= 0); ASSERT(metrics.capacity.bytes >= 0);
@ -403,7 +403,7 @@ bool TCTeamInfo::allServersHaveHealthyAvailableSpace() const {
double minAvailableSpaceRatio = double minAvailableSpaceRatio =
SERVER_KNOBS->AVAILABLE_SPACE_RATIO_CUTOFF + SERVER_KNOBS->AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER; SERVER_KNOBS->AVAILABLE_SPACE_RATIO_CUTOFF + SERVER_KNOBS->AVAILABLE_SPACE_RATIO_CUTOFF_SAFETY_BUFFER;
for (const auto& server : servers) { for (const auto& server : servers) {
if (!server->serverMetrics.present() || !server->hasHealthyAvailableSpace(minAvailableSpaceRatio)) { if (!server->serverMetricsPresent() || !server->hasHealthyAvailableSpace(minAvailableSpaceRatio)) {
result = false; result = false;
break; break;
} }