Use g_knobs for SERVER_KNOBS and CLIENT_KNOBS
This commit is contained in:
parent
a526d952d5
commit
cfc4545135
|
@ -3034,7 +3034,7 @@ struct CLIOptions {
|
|||
|
||||
// Reinitialize knobs in order to update knobs that are dependent on explicitly set knobs
|
||||
globalFlowKnobs->initialize(true);
|
||||
globalClientKnobs->initialize(true);
|
||||
g_knobs->initialize(true);
|
||||
}
|
||||
|
||||
int processArg(CSimpleOpt& args) {
|
||||
|
|
|
@ -30,6 +30,7 @@ set(FDBCLIENT_SRCS
|
|||
DatabaseContext.h
|
||||
EventTypes.actor.h
|
||||
FDBOptions.h
|
||||
FDBTypes.cpp
|
||||
FDBTypes.h
|
||||
FileBackupAgent.actor.cpp
|
||||
GlobalConfig.h
|
||||
|
@ -47,8 +48,9 @@ set(FDBCLIENT_SRCS
|
|||
KeyBackedTypes.h
|
||||
KeyRangeMap.actor.cpp
|
||||
KeyRangeMap.h
|
||||
Knobs.cpp
|
||||
Knobs.h
|
||||
KnobsImpl.cpp
|
||||
KnobsImpl.h
|
||||
IKnobCollection.cpp
|
||||
IKnobCollection.h
|
||||
ManagementAPI.actor.cpp
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* FDBTypes.cpp
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fdbclient/FDBTypes.h"
|
||||
#include "fdbclient/Knobs.h"
|
||||
|
||||
KeyRef keyBetween(const KeyRangeRef& keys) {
|
||||
int pos = 0; // will be the position of the first difference between keys.begin and keys.end
|
||||
int minSize = std::min(keys.begin.size(), keys.end.size());
|
||||
for (; pos < minSize && pos < CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT; pos++) {
|
||||
if (keys.begin[pos] != keys.end[pos]) {
|
||||
return keys.end.substr(0, pos + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// If one more character keeps us in the limit, and the latter key is simply
|
||||
// longer, then we only need one more byte of the end string.
|
||||
if (pos < CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT && keys.begin.size() < keys.end.size()) {
|
||||
return keys.end.substr(0, pos + 1);
|
||||
}
|
||||
|
||||
return keys.end;
|
||||
}
|
||||
|
||||
void KeySelectorRef::setKey(KeyRef const& key) {
|
||||
// There are no keys in the database with size greater than KEY_SIZE_LIMIT, so if this key selector has a key
|
||||
// which is large, then we can translate it to an equivalent key selector with a smaller key
|
||||
if (key.size() >
|
||||
(key.startsWith(LiteralStringRef("\xff")) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT : CLIENT_KNOBS->KEY_SIZE_LIMIT))
|
||||
this->key = key.substr(0,
|
||||
(key.startsWith(LiteralStringRef("\xff")) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT
|
||||
: CLIENT_KNOBS->KEY_SIZE_LIMIT) +
|
||||
1);
|
||||
else
|
||||
this->key = key;
|
||||
}
|
||||
|
||||
std::string KeySelectorRef::toString() const {
|
||||
if (offset > 0) {
|
||||
if (orEqual)
|
||||
return format("%d+firstGreaterThan(%s)", offset - 1, printable(key).c_str());
|
||||
else
|
||||
return format("%d+firstGreaterOrEqual(%s)", offset - 1, printable(key).c_str());
|
||||
} else {
|
||||
if (orEqual)
|
||||
return format("%d+lastLessOrEqual(%s)", offset, printable(key).c_str());
|
||||
else
|
||||
return format("%d+lastLessThan(%s)", offset, printable(key).c_str());
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include "flow/Arena.h"
|
||||
#include "flow/flow.h"
|
||||
#include "fdbclient/Knobs.h"
|
||||
|
||||
typedef int64_t Version;
|
||||
typedef uint64_t LogEpoch;
|
||||
|
@ -512,28 +511,12 @@ inline KeyRange prefixRange(KeyRef prefix) {
|
|||
range.contents() = KeyRangeRef(start, end);
|
||||
return range;
|
||||
}
|
||||
inline KeyRef keyBetween(const KeyRangeRef& keys) {
|
||||
// Returns (one of) the shortest key(s) either contained in keys or equal to keys.end,
|
||||
// assuming its length is no more than CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT. If the length of
|
||||
// the shortest key exceeds that limit, then the end key is returned.
|
||||
// The returned reference is valid as long as keys is valid.
|
||||
|
||||
int pos = 0; // will be the position of the first difference between keys.begin and keys.end
|
||||
int minSize = std::min(keys.begin.size(), keys.end.size());
|
||||
for (; pos < minSize && pos < CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT; pos++) {
|
||||
if (keys.begin[pos] != keys.end[pos]) {
|
||||
return keys.end.substr(0, pos + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// If one more character keeps us in the limit, and the latter key is simply
|
||||
// longer, then we only need one more byte of the end string.
|
||||
if (pos < CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT && keys.begin.size() < keys.end.size()) {
|
||||
return keys.end.substr(0, pos + 1);
|
||||
}
|
||||
|
||||
return keys.end;
|
||||
}
|
||||
// Returns (one of) the shortest key(s) either contained in keys or equal to keys.end,
|
||||
// assuming its length is no more than CLIENT_KNOBS->SPLIT_KEY_SIZE_LIMIT. If the length of
|
||||
// the shortest key exceeds that limit, then the end key is returned.
|
||||
// The returned reference is valid as long as keys is valid.
|
||||
KeyRef keyBetween(const KeyRangeRef& keys);
|
||||
|
||||
struct KeySelectorRef {
|
||||
private:
|
||||
|
@ -558,32 +541,9 @@ public:
|
|||
|
||||
KeyRef getKey() const { return key; }
|
||||
|
||||
void setKey(KeyRef const& key) {
|
||||
// There are no keys in the database with size greater than KEY_SIZE_LIMIT, so if this key selector has a key
|
||||
// which is large, then we can translate it to an equivalent key selector with a smaller key
|
||||
if (key.size() > (key.startsWith(LiteralStringRef("\xff")) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT
|
||||
: CLIENT_KNOBS->KEY_SIZE_LIMIT))
|
||||
this->key = key.substr(0,
|
||||
(key.startsWith(LiteralStringRef("\xff")) ? CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT
|
||||
: CLIENT_KNOBS->KEY_SIZE_LIMIT) +
|
||||
1);
|
||||
else
|
||||
this->key = key;
|
||||
}
|
||||
void setKey(KeyRef const& key);
|
||||
|
||||
std::string toString() const {
|
||||
if (offset > 0) {
|
||||
if (orEqual)
|
||||
return format("%d+firstGreaterThan(%s)", offset - 1, printable(key).c_str());
|
||||
else
|
||||
return format("%d+firstGreaterOrEqual(%s)", offset - 1, printable(key).c_str());
|
||||
} else {
|
||||
if (orEqual)
|
||||
return format("%d+lastLessOrEqual(%s)", offset, printable(key).c_str());
|
||||
else
|
||||
return format("%d+lastLessThan(%s)", offset, printable(key).c_str());
|
||||
}
|
||||
}
|
||||
std::string toString() const;
|
||||
|
||||
bool isBackward() const {
|
||||
return !orEqual && offset <= 0;
|
||||
|
|
|
@ -71,4 +71,4 @@ KnobValue IKnobCollection::parseKnobValue(std::string const& knobName,
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<IKnobCollection> g_knobs;
|
||||
std::unique_ptr<IKnobCollection> g_knobs = IKnobCollection::createClientKnobCollection(false, false);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "fdbclient/ConfigKnobs.h"
|
||||
#include "fdbclient/Knobs.h"
|
||||
#include "fdbclient/KnobsImpl.h"
|
||||
#include "fdbclient/ServerKnobs.h"
|
||||
#include "flow/Knobs.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Knobs.h
|
||||
* KnobsImpl.h
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
|
@ -18,225 +18,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FDBCLIENT_KNOBS_H
|
||||
#define FDBCLIENT_KNOBS_H
|
||||
#pragma once
|
||||
|
||||
#include "flow/Knobs.h"
|
||||
#include "flow/flow.h"
|
||||
#include "fdbclient/IKnobCollection.h"
|
||||
|
||||
class ClientKnobs : public KnobsImpl<ClientKnobs> {
|
||||
public:
|
||||
int TOO_MANY; // FIXME: this should really be split up so we can control these more specifically
|
||||
|
||||
double SYSTEM_MONITOR_INTERVAL;
|
||||
double NETWORK_BUSYNESS_MONITOR_INTERVAL; // The interval in which we should update the network busyness metric
|
||||
|
||||
double FAILURE_MAX_DELAY;
|
||||
double FAILURE_MIN_DELAY;
|
||||
double FAILURE_TIMEOUT_DELAY;
|
||||
double CLIENT_FAILURE_TIMEOUT_DELAY;
|
||||
double FAILURE_EMERGENCY_DELAY;
|
||||
double FAILURE_MAX_GENERATIONS;
|
||||
double RECOVERY_DELAY_START_GENERATION;
|
||||
double RECOVERY_DELAY_SECONDS_PER_GENERATION;
|
||||
double MAX_GENERATIONS;
|
||||
double MAX_GENERATIONS_OVERRIDE;
|
||||
double MAX_GENERATIONS_SIM;
|
||||
|
||||
double COORDINATOR_RECONNECTION_DELAY;
|
||||
int CLIENT_EXAMPLE_AMOUNT;
|
||||
double MAX_CLIENT_STATUS_AGE;
|
||||
int MAX_COMMIT_PROXY_CONNECTIONS;
|
||||
int MAX_GRV_PROXY_CONNECTIONS;
|
||||
double STATUS_IDLE_TIMEOUT;
|
||||
|
||||
// wrong_shard_server sometimes comes from the only nonfailed server, so we need to avoid a fast spin
|
||||
double WRONG_SHARD_SERVER_DELAY; // SOMEDAY: This delay can limit performance of retrieving data when the cache is
|
||||
// mostly wrong (e.g. dumping the database after a test)
|
||||
double FUTURE_VERSION_RETRY_DELAY;
|
||||
int REPLY_BYTE_LIMIT;
|
||||
double DEFAULT_BACKOFF;
|
||||
double DEFAULT_MAX_BACKOFF;
|
||||
double BACKOFF_GROWTH_RATE;
|
||||
double RESOURCE_CONSTRAINED_MAX_BACKOFF;
|
||||
int PROXY_COMMIT_OVERHEAD_BYTES;
|
||||
double SHARD_STAT_SMOOTH_AMOUNT;
|
||||
int INIT_MID_SHARD_BYTES;
|
||||
|
||||
int TRANSACTION_SIZE_LIMIT;
|
||||
int64_t KEY_SIZE_LIMIT;
|
||||
int64_t SYSTEM_KEY_SIZE_LIMIT;
|
||||
int64_t VALUE_SIZE_LIMIT;
|
||||
int64_t SPLIT_KEY_SIZE_LIMIT;
|
||||
int METADATA_VERSION_CACHE_SIZE;
|
||||
|
||||
int MAX_BATCH_SIZE;
|
||||
double GRV_BATCH_TIMEOUT;
|
||||
int BROADCAST_BATCH_SIZE;
|
||||
double TRANSACTION_TIMEOUT_DELAY_INTERVAL;
|
||||
|
||||
// When locationCache in DatabaseContext gets to be this size, items will be evicted
|
||||
int LOCATION_CACHE_EVICTION_SIZE;
|
||||
int LOCATION_CACHE_EVICTION_SIZE_SIM;
|
||||
|
||||
int GET_RANGE_SHARD_LIMIT;
|
||||
int WARM_RANGE_SHARD_LIMIT;
|
||||
int STORAGE_METRICS_SHARD_LIMIT;
|
||||
int SHARD_COUNT_LIMIT;
|
||||
double STORAGE_METRICS_UNFAIR_SPLIT_LIMIT;
|
||||
double STORAGE_METRICS_TOO_MANY_SHARDS_DELAY;
|
||||
double AGGREGATE_HEALTH_METRICS_MAX_STALENESS;
|
||||
double DETAILED_HEALTH_METRICS_MAX_STALENESS;
|
||||
double MID_SHARD_SIZE_MAX_STALENESS;
|
||||
bool TAG_ENCODE_KEY_SERVERS;
|
||||
|
||||
// KeyRangeMap
|
||||
int KRM_GET_RANGE_LIMIT;
|
||||
int KRM_GET_RANGE_LIMIT_BYTES; // This must be sufficiently larger than KEY_SIZE_LIMIT to ensure that at least two
|
||||
// entries will be returned from an attempt to read a key range map
|
||||
|
||||
int DEFAULT_MAX_OUTSTANDING_WATCHES;
|
||||
int ABSOLUTE_MAX_WATCHES; // The client cannot set the max outstanding watches higher than this
|
||||
double WATCH_POLLING_TIME;
|
||||
double NO_RECENT_UPDATES_DURATION;
|
||||
double FAST_WATCH_TIMEOUT;
|
||||
double WATCH_TIMEOUT;
|
||||
|
||||
double IS_ACCEPTABLE_DELAY;
|
||||
|
||||
// Core
|
||||
int64_t CORE_VERSIONSPERSECOND; // This is defined within the server but used for knobs based on server value
|
||||
int LOG_RANGE_BLOCK_SIZE;
|
||||
int MUTATION_BLOCK_SIZE;
|
||||
|
||||
// Taskbucket
|
||||
double TASKBUCKET_LOGGING_DELAY;
|
||||
int TASKBUCKET_MAX_PRIORITY;
|
||||
double TASKBUCKET_CHECK_TIMEOUT_CHANCE;
|
||||
double TASKBUCKET_TIMEOUT_JITTER_OFFSET;
|
||||
double TASKBUCKET_TIMEOUT_JITTER_RANGE;
|
||||
double TASKBUCKET_CHECK_ACTIVE_DELAY;
|
||||
int TASKBUCKET_CHECK_ACTIVE_AMOUNT;
|
||||
int TASKBUCKET_TIMEOUT_VERSIONS;
|
||||
int TASKBUCKET_MAX_TASK_KEYS;
|
||||
|
||||
// Backup
|
||||
int BACKUP_LOCAL_FILE_WRITE_BLOCK;
|
||||
int BACKUP_CONCURRENT_DELETES;
|
||||
int BACKUP_SIMULATED_LIMIT_BYTES;
|
||||
int BACKUP_GET_RANGE_LIMIT_BYTES;
|
||||
int BACKUP_LOCK_BYTES;
|
||||
double BACKUP_RANGE_TIMEOUT;
|
||||
double BACKUP_RANGE_MINWAIT;
|
||||
int BACKUP_SNAPSHOT_DISPATCH_INTERVAL_SEC;
|
||||
int BACKUP_DEFAULT_SNAPSHOT_INTERVAL_SEC;
|
||||
int BACKUP_SHARD_TASK_LIMIT;
|
||||
double BACKUP_AGGREGATE_POLL_RATE;
|
||||
double BACKUP_AGGREGATE_POLL_RATE_UPDATE_INTERVAL;
|
||||
int BACKUP_LOG_WRITE_BATCH_MAX_SIZE;
|
||||
int BACKUP_LOG_ATOMIC_OPS_SIZE;
|
||||
int BACKUP_MAX_LOG_RANGES;
|
||||
int BACKUP_SIM_COPY_LOG_RANGES;
|
||||
int BACKUP_OPERATION_COST_OVERHEAD;
|
||||
int BACKUP_VERSION_DELAY;
|
||||
int BACKUP_MAP_KEY_LOWER_LIMIT;
|
||||
int BACKUP_MAP_KEY_UPPER_LIMIT;
|
||||
int BACKUP_COPY_TASKS;
|
||||
int BACKUP_BLOCK_SIZE;
|
||||
int COPY_LOG_BLOCK_SIZE;
|
||||
int COPY_LOG_BLOCKS_PER_TASK;
|
||||
int COPY_LOG_PREFETCH_BLOCKS;
|
||||
int COPY_LOG_READ_AHEAD_BYTES;
|
||||
double COPY_LOG_TASK_DURATION_NANOS;
|
||||
int BACKUP_TASKS_PER_AGENT;
|
||||
int BACKUP_POLL_PROGRESS_SECONDS;
|
||||
int64_t VERSIONS_PER_SECOND; // Copy of SERVER_KNOBS, as we can't link with it
|
||||
int SIM_BACKUP_TASKS_PER_AGENT;
|
||||
int BACKUP_RANGEFILE_BLOCK_SIZE;
|
||||
int BACKUP_LOGFILE_BLOCK_SIZE;
|
||||
int BACKUP_DISPATCH_ADDTASK_SIZE;
|
||||
int RESTORE_DISPATCH_ADDTASK_SIZE;
|
||||
int RESTORE_DISPATCH_BATCH_SIZE;
|
||||
int RESTORE_WRITE_TX_SIZE;
|
||||
int APPLY_MAX_LOCK_BYTES;
|
||||
int APPLY_MIN_LOCK_BYTES;
|
||||
int APPLY_BLOCK_SIZE;
|
||||
double APPLY_MAX_DECAY_RATE;
|
||||
double APPLY_MAX_INCREASE_FACTOR;
|
||||
double BACKUP_ERROR_DELAY;
|
||||
double BACKUP_STATUS_DELAY;
|
||||
double BACKUP_STATUS_JITTER;
|
||||
double MIN_CLEANUP_SECONDS;
|
||||
bool RESTORE_IGNORE_LOG_FILES; // Default is false. When set to true, the log files will be ignored during the restore, which can produce inconsistent restored data.
|
||||
int64_t FASTRESTORE_ATOMICOP_WEIGHT; // workload amplication factor for atomic op
|
||||
|
||||
// Configuration
|
||||
int32_t DEFAULT_AUTO_COMMIT_PROXIES;
|
||||
int32_t DEFAULT_AUTO_GRV_PROXIES;
|
||||
int32_t DEFAULT_COMMIT_GRV_PROXIES_RATIO;
|
||||
int32_t DEFAULT_MAX_GRV_PROXIES;
|
||||
int32_t DEFAULT_AUTO_RESOLVERS;
|
||||
int32_t DEFAULT_AUTO_LOGS;
|
||||
|
||||
// Client Status Info
|
||||
double CSI_SAMPLING_PROBABILITY;
|
||||
int64_t CSI_SIZE_LIMIT;
|
||||
double CSI_STATUS_DELAY;
|
||||
|
||||
int HTTP_SEND_SIZE;
|
||||
int HTTP_READ_SIZE;
|
||||
int HTTP_VERBOSE_LEVEL;
|
||||
std::string HTTP_REQUEST_ID_HEADER;
|
||||
int BLOBSTORE_CONNECT_TRIES;
|
||||
int BLOBSTORE_CONNECT_TIMEOUT;
|
||||
int BLOBSTORE_MAX_CONNECTION_LIFE;
|
||||
int BLOBSTORE_REQUEST_TRIES;
|
||||
int BLOBSTORE_REQUEST_TIMEOUT_MIN;
|
||||
int BLOBSTORE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_LIST_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_WRITE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_READ_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_DELETE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_CONCURRENT_REQUESTS;
|
||||
int BLOBSTORE_MULTIPART_MAX_PART_SIZE;
|
||||
int BLOBSTORE_MULTIPART_MIN_PART_SIZE;
|
||||
int BLOBSTORE_CONCURRENT_UPLOADS;
|
||||
int BLOBSTORE_CONCURRENT_LISTS;
|
||||
int BLOBSTORE_CONCURRENT_WRITES_PER_FILE;
|
||||
int BLOBSTORE_CONCURRENT_READS_PER_FILE;
|
||||
int BLOBSTORE_READ_BLOCK_SIZE;
|
||||
int BLOBSTORE_READ_AHEAD_BLOCKS;
|
||||
int BLOBSTORE_READ_CACHE_BLOCKS_PER_FILE;
|
||||
int BLOBSTORE_MAX_SEND_BYTES_PER_SECOND;
|
||||
int BLOBSTORE_MAX_RECV_BYTES_PER_SECOND;
|
||||
|
||||
int CONSISTENCY_CHECK_RATE_LIMIT_MAX;
|
||||
int CONSISTENCY_CHECK_ONE_ROUND_TARGET_COMPLETION_TIME;
|
||||
|
||||
// fdbcli
|
||||
int CLI_CONNECT_PARALLELISM;
|
||||
double CLI_CONNECT_TIMEOUT;
|
||||
|
||||
// trace
|
||||
int TRACE_LOG_FILE_IDENTIFIER_MAX_LENGTH;
|
||||
|
||||
// transaction tags
|
||||
int MAX_TRANSACTION_TAG_LENGTH;
|
||||
int MAX_TAGS_PER_TRANSACTION;
|
||||
int COMMIT_SAMPLE_COST; // The expectation of sampling is every COMMIT_SAMPLE_COST sample once
|
||||
int WRITE_COST_BYTE_FACTOR;
|
||||
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;
|
||||
double TAG_THROTTLE_EXPIRATION_INTERVAL;
|
||||
|
||||
ClientKnobs();
|
||||
void initialize(bool randomize = false);
|
||||
};
|
||||
|
||||
extern std::unique_ptr<ClientKnobs> globalClientKnobs;
|
||||
extern ClientKnobs const* CLIENT_KNOBS;
|
||||
|
||||
#endif
|
||||
#define CLIENT_KNOBS (&g_knobs->getClientKnobs())
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
#include "fdbclient/SystemData.h"
|
||||
#include "flow/UnitTest.h"
|
||||
|
||||
std::unique_ptr<ClientKnobs> globalClientKnobs = std::make_unique<ClientKnobs>();
|
||||
ClientKnobs const* CLIENT_KNOBS = globalClientKnobs.get();
|
||||
|
||||
#define init(knob, value) initKnob(knob, value, #knob)
|
||||
|
||||
ClientKnobs::ClientKnobs() {
|
||||
|
@ -256,7 +253,7 @@ TEST_CASE("/fdbclient/knobs/initialize") {
|
|||
ClientKnobs clientKnobs;
|
||||
int64_t initialCoreVersionsPerSecond = clientKnobs.CORE_VERSIONSPERSECOND;
|
||||
int initialTaskBucketTimeoutVersions = clientKnobs.TASKBUCKET_TIMEOUT_VERSIONS;
|
||||
clientKnobs.setKnob("core_versionspersecond", initialCoreVersionsPerSecond*2);
|
||||
clientKnobs.setKnob("core_versionspersecond", initialCoreVersionsPerSecond * 2);
|
||||
ASSERT_EQ(clientKnobs.CORE_VERSIONSPERSECOND, initialCoreVersionsPerSecond * 2);
|
||||
ASSERT_EQ(clientKnobs.TASKBUCKET_TIMEOUT_VERSIONS, initialTaskBucketTimeoutVersions);
|
||||
clientKnobs.initialize();
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* KnobsImpl.h
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FDBCLIENT_KNOBS_H
|
||||
#define FDBCLIENT_KNOBS_H
|
||||
#pragma once
|
||||
|
||||
#include "flow/Knobs.h"
|
||||
#include "flow/flow.h"
|
||||
|
||||
class ClientKnobs : public KnobsImpl<ClientKnobs> {
|
||||
public:
|
||||
int TOO_MANY; // FIXME: this should really be split up so we can control these more specifically
|
||||
|
||||
double SYSTEM_MONITOR_INTERVAL;
|
||||
double NETWORK_BUSYNESS_MONITOR_INTERVAL; // The interval in which we should update the network busyness metric
|
||||
|
||||
double FAILURE_MAX_DELAY;
|
||||
double FAILURE_MIN_DELAY;
|
||||
double FAILURE_TIMEOUT_DELAY;
|
||||
double CLIENT_FAILURE_TIMEOUT_DELAY;
|
||||
double FAILURE_EMERGENCY_DELAY;
|
||||
double FAILURE_MAX_GENERATIONS;
|
||||
double RECOVERY_DELAY_START_GENERATION;
|
||||
double RECOVERY_DELAY_SECONDS_PER_GENERATION;
|
||||
double MAX_GENERATIONS;
|
||||
double MAX_GENERATIONS_OVERRIDE;
|
||||
double MAX_GENERATIONS_SIM;
|
||||
|
||||
double COORDINATOR_RECONNECTION_DELAY;
|
||||
int CLIENT_EXAMPLE_AMOUNT;
|
||||
double MAX_CLIENT_STATUS_AGE;
|
||||
int MAX_COMMIT_PROXY_CONNECTIONS;
|
||||
int MAX_GRV_PROXY_CONNECTIONS;
|
||||
double STATUS_IDLE_TIMEOUT;
|
||||
|
||||
// wrong_shard_server sometimes comes from the only nonfailed server, so we need to avoid a fast spin
|
||||
double WRONG_SHARD_SERVER_DELAY; // SOMEDAY: This delay can limit performance of retrieving data when the cache is
|
||||
// mostly wrong (e.g. dumping the database after a test)
|
||||
double FUTURE_VERSION_RETRY_DELAY;
|
||||
int REPLY_BYTE_LIMIT;
|
||||
double DEFAULT_BACKOFF;
|
||||
double DEFAULT_MAX_BACKOFF;
|
||||
double BACKOFF_GROWTH_RATE;
|
||||
double RESOURCE_CONSTRAINED_MAX_BACKOFF;
|
||||
int PROXY_COMMIT_OVERHEAD_BYTES;
|
||||
double SHARD_STAT_SMOOTH_AMOUNT;
|
||||
int INIT_MID_SHARD_BYTES;
|
||||
|
||||
int TRANSACTION_SIZE_LIMIT;
|
||||
int64_t KEY_SIZE_LIMIT;
|
||||
int64_t SYSTEM_KEY_SIZE_LIMIT;
|
||||
int64_t VALUE_SIZE_LIMIT;
|
||||
int64_t SPLIT_KEY_SIZE_LIMIT;
|
||||
int METADATA_VERSION_CACHE_SIZE;
|
||||
|
||||
int MAX_BATCH_SIZE;
|
||||
double GRV_BATCH_TIMEOUT;
|
||||
int BROADCAST_BATCH_SIZE;
|
||||
double TRANSACTION_TIMEOUT_DELAY_INTERVAL;
|
||||
|
||||
// When locationCache in DatabaseContext gets to be this size, items will be evicted
|
||||
int LOCATION_CACHE_EVICTION_SIZE;
|
||||
int LOCATION_CACHE_EVICTION_SIZE_SIM;
|
||||
|
||||
int GET_RANGE_SHARD_LIMIT;
|
||||
int WARM_RANGE_SHARD_LIMIT;
|
||||
int STORAGE_METRICS_SHARD_LIMIT;
|
||||
int SHARD_COUNT_LIMIT;
|
||||
double STORAGE_METRICS_UNFAIR_SPLIT_LIMIT;
|
||||
double STORAGE_METRICS_TOO_MANY_SHARDS_DELAY;
|
||||
double AGGREGATE_HEALTH_METRICS_MAX_STALENESS;
|
||||
double DETAILED_HEALTH_METRICS_MAX_STALENESS;
|
||||
double MID_SHARD_SIZE_MAX_STALENESS;
|
||||
bool TAG_ENCODE_KEY_SERVERS;
|
||||
|
||||
// KeyRangeMap
|
||||
int KRM_GET_RANGE_LIMIT;
|
||||
int KRM_GET_RANGE_LIMIT_BYTES; // This must be sufficiently larger than KEY_SIZE_LIMIT to ensure that at least two
|
||||
// entries will be returned from an attempt to read a key range map
|
||||
|
||||
int DEFAULT_MAX_OUTSTANDING_WATCHES;
|
||||
int ABSOLUTE_MAX_WATCHES; // The client cannot set the max outstanding watches higher than this
|
||||
double WATCH_POLLING_TIME;
|
||||
double NO_RECENT_UPDATES_DURATION;
|
||||
double FAST_WATCH_TIMEOUT;
|
||||
double WATCH_TIMEOUT;
|
||||
|
||||
double IS_ACCEPTABLE_DELAY;
|
||||
|
||||
// Core
|
||||
int64_t CORE_VERSIONSPERSECOND; // This is defined within the server but used for knobs based on server value
|
||||
int LOG_RANGE_BLOCK_SIZE;
|
||||
int MUTATION_BLOCK_SIZE;
|
||||
|
||||
// Taskbucket
|
||||
double TASKBUCKET_LOGGING_DELAY;
|
||||
int TASKBUCKET_MAX_PRIORITY;
|
||||
double TASKBUCKET_CHECK_TIMEOUT_CHANCE;
|
||||
double TASKBUCKET_TIMEOUT_JITTER_OFFSET;
|
||||
double TASKBUCKET_TIMEOUT_JITTER_RANGE;
|
||||
double TASKBUCKET_CHECK_ACTIVE_DELAY;
|
||||
int TASKBUCKET_CHECK_ACTIVE_AMOUNT;
|
||||
int TASKBUCKET_TIMEOUT_VERSIONS;
|
||||
int TASKBUCKET_MAX_TASK_KEYS;
|
||||
|
||||
// Backup
|
||||
int BACKUP_LOCAL_FILE_WRITE_BLOCK;
|
||||
int BACKUP_CONCURRENT_DELETES;
|
||||
int BACKUP_SIMULATED_LIMIT_BYTES;
|
||||
int BACKUP_GET_RANGE_LIMIT_BYTES;
|
||||
int BACKUP_LOCK_BYTES;
|
||||
double BACKUP_RANGE_TIMEOUT;
|
||||
double BACKUP_RANGE_MINWAIT;
|
||||
int BACKUP_SNAPSHOT_DISPATCH_INTERVAL_SEC;
|
||||
int BACKUP_DEFAULT_SNAPSHOT_INTERVAL_SEC;
|
||||
int BACKUP_SHARD_TASK_LIMIT;
|
||||
double BACKUP_AGGREGATE_POLL_RATE;
|
||||
double BACKUP_AGGREGATE_POLL_RATE_UPDATE_INTERVAL;
|
||||
int BACKUP_LOG_WRITE_BATCH_MAX_SIZE;
|
||||
int BACKUP_LOG_ATOMIC_OPS_SIZE;
|
||||
int BACKUP_MAX_LOG_RANGES;
|
||||
int BACKUP_SIM_COPY_LOG_RANGES;
|
||||
int BACKUP_OPERATION_COST_OVERHEAD;
|
||||
int BACKUP_VERSION_DELAY;
|
||||
int BACKUP_MAP_KEY_LOWER_LIMIT;
|
||||
int BACKUP_MAP_KEY_UPPER_LIMIT;
|
||||
int BACKUP_COPY_TASKS;
|
||||
int BACKUP_BLOCK_SIZE;
|
||||
int COPY_LOG_BLOCK_SIZE;
|
||||
int COPY_LOG_BLOCKS_PER_TASK;
|
||||
int COPY_LOG_PREFETCH_BLOCKS;
|
||||
int COPY_LOG_READ_AHEAD_BYTES;
|
||||
double COPY_LOG_TASK_DURATION_NANOS;
|
||||
int BACKUP_TASKS_PER_AGENT;
|
||||
int BACKUP_POLL_PROGRESS_SECONDS;
|
||||
int64_t VERSIONS_PER_SECOND; // Copy of SERVER_KNOBS, as we can't link with it
|
||||
int SIM_BACKUP_TASKS_PER_AGENT;
|
||||
int BACKUP_RANGEFILE_BLOCK_SIZE;
|
||||
int BACKUP_LOGFILE_BLOCK_SIZE;
|
||||
int BACKUP_DISPATCH_ADDTASK_SIZE;
|
||||
int RESTORE_DISPATCH_ADDTASK_SIZE;
|
||||
int RESTORE_DISPATCH_BATCH_SIZE;
|
||||
int RESTORE_WRITE_TX_SIZE;
|
||||
int APPLY_MAX_LOCK_BYTES;
|
||||
int APPLY_MIN_LOCK_BYTES;
|
||||
int APPLY_BLOCK_SIZE;
|
||||
double APPLY_MAX_DECAY_RATE;
|
||||
double APPLY_MAX_INCREASE_FACTOR;
|
||||
double BACKUP_ERROR_DELAY;
|
||||
double BACKUP_STATUS_DELAY;
|
||||
double BACKUP_STATUS_JITTER;
|
||||
double MIN_CLEANUP_SECONDS;
|
||||
bool RESTORE_IGNORE_LOG_FILES; // Default is false. When set to true, the log files will be ignored during the
|
||||
// restore, which can produce inconsistent restored data.
|
||||
int64_t FASTRESTORE_ATOMICOP_WEIGHT; // workload amplication factor for atomic op
|
||||
|
||||
// Configuration
|
||||
int32_t DEFAULT_AUTO_COMMIT_PROXIES;
|
||||
int32_t DEFAULT_AUTO_GRV_PROXIES;
|
||||
int32_t DEFAULT_COMMIT_GRV_PROXIES_RATIO;
|
||||
int32_t DEFAULT_MAX_GRV_PROXIES;
|
||||
int32_t DEFAULT_AUTO_RESOLVERS;
|
||||
int32_t DEFAULT_AUTO_LOGS;
|
||||
|
||||
// Client Status Info
|
||||
double CSI_SAMPLING_PROBABILITY;
|
||||
int64_t CSI_SIZE_LIMIT;
|
||||
double CSI_STATUS_DELAY;
|
||||
|
||||
int HTTP_SEND_SIZE;
|
||||
int HTTP_READ_SIZE;
|
||||
int HTTP_VERBOSE_LEVEL;
|
||||
std::string HTTP_REQUEST_ID_HEADER;
|
||||
int BLOBSTORE_CONNECT_TRIES;
|
||||
int BLOBSTORE_CONNECT_TIMEOUT;
|
||||
int BLOBSTORE_MAX_CONNECTION_LIFE;
|
||||
int BLOBSTORE_REQUEST_TRIES;
|
||||
int BLOBSTORE_REQUEST_TIMEOUT_MIN;
|
||||
int BLOBSTORE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_LIST_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_WRITE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_READ_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_DELETE_REQUESTS_PER_SECOND;
|
||||
int BLOBSTORE_CONCURRENT_REQUESTS;
|
||||
int BLOBSTORE_MULTIPART_MAX_PART_SIZE;
|
||||
int BLOBSTORE_MULTIPART_MIN_PART_SIZE;
|
||||
int BLOBSTORE_CONCURRENT_UPLOADS;
|
||||
int BLOBSTORE_CONCURRENT_LISTS;
|
||||
int BLOBSTORE_CONCURRENT_WRITES_PER_FILE;
|
||||
int BLOBSTORE_CONCURRENT_READS_PER_FILE;
|
||||
int BLOBSTORE_READ_BLOCK_SIZE;
|
||||
int BLOBSTORE_READ_AHEAD_BLOCKS;
|
||||
int BLOBSTORE_READ_CACHE_BLOCKS_PER_FILE;
|
||||
int BLOBSTORE_MAX_SEND_BYTES_PER_SECOND;
|
||||
int BLOBSTORE_MAX_RECV_BYTES_PER_SECOND;
|
||||
|
||||
int CONSISTENCY_CHECK_RATE_LIMIT_MAX;
|
||||
int CONSISTENCY_CHECK_ONE_ROUND_TARGET_COMPLETION_TIME;
|
||||
|
||||
// fdbcli
|
||||
int CLI_CONNECT_PARALLELISM;
|
||||
double CLI_CONNECT_TIMEOUT;
|
||||
|
||||
// trace
|
||||
int TRACE_LOG_FILE_IDENTIFIER_MAX_LENGTH;
|
||||
|
||||
// transaction tags
|
||||
int MAX_TRANSACTION_TAG_LENGTH;
|
||||
int MAX_TAGS_PER_TRANSACTION;
|
||||
int COMMIT_SAMPLE_COST; // The expectation of sampling is every COMMIT_SAMPLE_COST sample once
|
||||
int WRITE_COST_BYTE_FACTOR;
|
||||
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;
|
||||
double TAG_THROTTLE_EXPIRATION_INTERVAL;
|
||||
|
||||
ClientKnobs();
|
||||
void initialize(bool randomize = false);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -23,7 +23,7 @@
|
|||
#include "flow/Knobs.h"
|
||||
#include "fdbrpc/fdbrpc.h"
|
||||
#include "fdbrpc/Locality.h"
|
||||
#include "fdbclient/Knobs.h"
|
||||
#include "fdbclient/KnobsImpl.h"
|
||||
|
||||
// Disk queue
|
||||
static constexpr int _PAGE_SIZE = 4096;
|
||||
|
|
|
@ -41,7 +41,6 @@ set(FDBSERVER_SRCS
|
|||
KeyValueStoreMemory.actor.cpp
|
||||
KeyValueStoreRocksDB.actor.cpp
|
||||
KeyValueStoreSQLite.actor.cpp
|
||||
Knobs.cpp
|
||||
Knobs.h
|
||||
LatencyBandConfig.cpp
|
||||
LatencyBandConfig.h
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fdbclient/Knobs.h"
|
||||
#include "fdbclient/Notified.h"
|
||||
#include "fdbclient/SystemData.h"
|
||||
#include "fdbserver/DeltaTree.h"
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Knobs.cpp
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fdbserver/Knobs.h"
|
||||
|
||||
std::unique_ptr<ServerKnobs> globalServerKnobs = std::make_unique<ServerKnobs>();
|
||||
ServerKnobs const* SERVER_KNOBS = globalServerKnobs.get();
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "fdbclient/ServerKnobs.h"
|
||||
#include "fdbclient/IKnobCollection.h"
|
||||
|
||||
extern std::unique_ptr<ServerKnobs> globalServerKnobs;
|
||||
extern ServerKnobs const* SERVER_KNOBS;
|
||||
#define SERVER_KNOBS (&g_knobs->getServerKnobs())
|
||||
|
|
|
@ -263,7 +263,7 @@ class LocalConfigurationImpl {
|
|||
self->lastSeenVersion, self->configKnobOverrides.getConfigClassSet() }));
|
||||
TraceEvent(SevDebug, "LocalConfigGotChanges", self->id)
|
||||
.detail("Size", changesReply.changes.size())
|
||||
.detail("Version", changes.version);
|
||||
.detail("Version", changesReply.mostRecentVersion);
|
||||
wait(self->addChanges(changesReply.changes, changesReply.mostRecentVersion));
|
||||
} catch (Error& e) {
|
||||
if (e.code() == error_code_version_already_compacted) {
|
||||
|
|
|
@ -218,7 +218,8 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
|
|||
|
||||
Future<Void> setup(Database const& cx) override {
|
||||
if (clientId == 0) {
|
||||
globalClientKnobs->CSI_STATUS_DELAY = 2.0; // 2 seconds
|
||||
auto knobValue = g_knobs->parseKnobValue("csi_status_delay", "2.0"); // 2 seconds
|
||||
g_knobs->setKnob("csi_status_delay", knobValue);
|
||||
return changeProfilingParameters(cx, trInfoSizeLimit, samplingProbability);
|
||||
}
|
||||
return Void();
|
||||
|
|
Loading…
Reference in New Issue