add INCOMPLETE_SHARD_PLUS knob

This commit is contained in:
Xiaoxi Wang 2020-08-04 03:18:05 +00:00
parent 484a75dd7b
commit 48094ea17e
3 changed files with 7 additions and 3 deletions

View File

@ -66,7 +66,7 @@ void ClientKnobs::initialize(bool randomize) {
init( RESOURCE_CONSTRAINED_MAX_BACKOFF, 30.0 );
init( PROXY_COMMIT_OVERHEAD_BYTES, 23 ); //The size of serializing 7 tags (3 primary, 3 remote, 1 log router) + 2 for the tag length
init( DEFAULT_SMOOTH_AMOUNT, 5.0 );
init( INIT_MEAN_SHARD_BYTES, 16384 );
init( INIT_MEAN_SHARD_BYTES, 200000 ); if( randomize && BUGGIFY ) INIT_MEAN_SHARD_BYTES = 40000; // The same value as SERVER_KNOBS->MIN_SHARD_BYTES
init( TRANSACTION_SIZE_LIMIT, 1e7 );
init( KEY_SIZE_LIMIT, 1e4 );
@ -231,6 +231,7 @@ void ClientKnobs::initialize(bool randomize) {
init( MAX_TAGS_PER_TRANSACTION, 5 );
init( MAX_TRANSACTION_TAG_LENGTH, 16 );
init( COMMIT_SAMPLE_BYTE, 65536 );
init( INCOMPLETE_SHARD_PLUS, 4096 );
init( READ_TAG_SAMPLE_RATE, 0.01 ); if( randomize && BUGGIFY ) READ_TAG_SAMPLE_RATE = 1.0; // Communicated to clients from cluster
init( TAG_THROTTLE_SMOOTHING_WINDOW, 2.0 );
init( TAG_THROTTLE_RECHECK_INTERVAL, 5.0 ); if( randomize && BUGGIFY ) TAG_THROTTLE_RECHECK_INTERVAL = 0.0;

View File

@ -217,7 +217,8 @@ public:
// transaction tags
int MAX_TRANSACTION_TAG_LENGTH;
int MAX_TAGS_PER_TRANSACTION;
int COMMIT_SAMPLE_BYTE;
int COMMIT_SAMPLE_BYTE; // The expectation of sampling is every COMMIT_SAMPLE_BYTE sample once
int INCOMPLETE_SHARD_PLUS; // The size of (possible) incomplete shard when estimate clear range
double READ_TAG_SAMPLE_RATE; // Communicated to clients from cluster
double TAG_THROTTLE_SMOOTHING_WINDOW;
double TAG_THROTTLE_RECHECK_INTERVAL;

View File

@ -3329,7 +3329,9 @@ ACTOR Future<Optional<ClientTrCommitCostEstimation>> estimateCommitCosts(Transac
std::vector<pair<KeyRange, Reference<LocationInfo>>> locations =
wait(getKeyRangeLocations(self->getDatabase(), keyRange, CLIENT_KNOBS->TOO_MANY, false,
&StorageServerInterface::getShardState, self->info));
uint64_t bytes = locations.size() * self->getDatabase()->smoothAvgShardSize.smoothTotal();
if (locations.empty()) continue;
uint64_t bytes = CLIENT_KNOBS->INCOMPLETE_SHARD_PLUS +
(locations.size() - 1) * self->getDatabase()->smoothAvgShardSize.smoothTotal();
trCommitCosts.clearIdxBytes.emplace(i, bytes);
trCommitCosts.writtenBytes += bytes;
}