diff --git a/fdbclient/Knobs.cpp b/fdbclient/Knobs.cpp index 14686c0e38..290bb06cf1 100644 --- a/fdbclient/Knobs.cpp +++ b/fdbclient/Knobs.cpp @@ -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; diff --git a/fdbclient/Knobs.h b/fdbclient/Knobs.h index ee1f447760..a9b03f3e58 100644 --- a/fdbclient/Knobs.h +++ b/fdbclient/Knobs.h @@ -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; diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 46500eb81b..2a832a0bf6 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -3329,7 +3329,9 @@ ACTOR Future> estimateCommitCosts(Transac std::vector>> 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; }