diff --git a/fdbclient/CommitTransaction.h b/fdbclient/CommitTransaction.h index bc74941704..308c7f938c 100644 --- a/fdbclient/CommitTransaction.h +++ b/fdbclient/CommitTransaction.h @@ -80,6 +80,7 @@ struct MutationRef { // This is stored this way for serialization purposes. uint8_t type; StringRef param1, param2; + bool clearSingleKey = false; // be only needed in client, so no serialization MutationRef() {} MutationRef( Type t, StringRef a, StringRef b ) : type(t), param1(a), param2(b) {} diff --git a/fdbclient/Knobs.cpp b/fdbclient/Knobs.cpp index 1903f5a5ef..9549626213 100644 --- a/fdbclient/Knobs.cpp +++ b/fdbclient/Knobs.cpp @@ -65,8 +65,8 @@ void ClientKnobs::initialize(bool randomize) { init( BACKOFF_GROWTH_RATE, 2.0 ); 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, 1.0); - init( INIT_MEAN_SHARD_BYTES, 20000); + init( DEFAULT_SMOOTH_AMOUNT, 5.0 ); + init( INIT_MEAN_SHARD_BYTES, 1024 ); init( TRANSACTION_SIZE_LIMIT, 1e7 ); init( KEY_SIZE_LIMIT, 1e4 ); @@ -230,7 +230,7 @@ void ClientKnobs::initialize(bool randomize) { // transaction tags init( MAX_TAGS_PER_TRANSACTION, 5 ); init( MAX_TRANSACTION_TAG_LENGTH, 16 ); - init( COMMIT_SAMPLE_BYTE, 50000 ); + init( COMMIT_SAMPLE_BYTE, 100000 ); 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/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index c355aeb2ad..6dd067d595 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -2985,7 +2985,7 @@ void Transaction::clear( const KeyRef& key, bool addConflictRange ) { data[key.size()] = 0; t.mutations.emplace_back(req.arena, MutationRef::ClearRange, KeyRef(data, key.size()), KeyRef(data, key.size() + 1)); - + t.mutations.back().clearSingleKey = true; if(addConflictRange) t.write_conflict_ranges.emplace_back(req.arena, KeyRef(data, key.size()), KeyRef(data, key.size() + 1)); } @@ -3272,13 +3272,18 @@ ACTOR Future> estimateCommitCosts(Transac CommitTransactionRef* transaction) { state ClientTrCommitCostEstimation trCommitCosts; state KeyRange keyRange; - for (int i = 0; i < transaction->mutations.size(); ++i) { + state int i = 0; + for (; i < transaction->mutations.size(); ++i) { auto* it = &transaction->mutations[i]; if (it->type == MutationRef::Type::SetValue || it->isAtomicOp()) { trCommitCosts.opsCount++; trCommitCosts.writtenBytes += it->expectedSize(); } else if (it->type == MutationRef::Type::ClearRange) { trCommitCosts.opsCount++; + if(it->clearSingleKey) { + trCommitCosts.clearIdxBytes.emplace(i, it->expectedSize()); // NOTE: whether we need a weight here? + continue; + } keyRange = KeyRange(KeyRangeRef(it->param1, it->param2)); if (self->options.expensiveClearCostEstimation) { StorageMetrics m = wait(self->getStorageMetrics(keyRange, std::numeric_limits::max())); diff --git a/fdbserver/Ratekeeper.actor.cpp b/fdbserver/Ratekeeper.actor.cpp index 273c3a7399..e1f13b8120 100644 --- a/fdbserver/Ratekeeper.actor.cpp +++ b/fdbserver/Ratekeeper.actor.cpp @@ -1239,7 +1239,7 @@ void updateRate(RatekeeperData* self, RatekeeperLimits* limits) { } } -void updateCommitCostEstimation(RatekeeperData* self, TransactionTagMap const& costEstimation) { +void updateCommitCostEstimation(RatekeeperData* self, UIDTransactionTagMap const& costEstimation) { // if(self->validSS <= 0) return; // int opsSum = 0; // double bytesSum = 0;