add version guard and add network option to testConfig
This commit is contained in:
parent
0f78f748f9
commit
a7956f42a4
|
@ -290,6 +290,22 @@ if(NOT WIN32)
|
|||
@LOG_DIR@
|
||||
)
|
||||
|
||||
add_fdbclient_test(
|
||||
NAME fdb_c_api_tests_local_only
|
||||
DISABLE_LOG_DUMP
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/run_c_api_tests.py
|
||||
--cluster-file
|
||||
@CLUSTER_FILE@
|
||||
--tester-binary
|
||||
$<TARGET_FILE:fdb_c_api_tester>
|
||||
--test-dir
|
||||
${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/local_tests
|
||||
--tmp-dir
|
||||
@TMP_DIR@
|
||||
--log-dir
|
||||
@LOG_DIR@
|
||||
)
|
||||
|
||||
add_fdbclient_test(
|
||||
NAME fdb_c_api_tests_blob_granule
|
||||
DISABLE_LOG_DUMP
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
[[test]]
|
||||
title = 'API Correctness Single Threaded'
|
||||
minClients = 1
|
||||
maxClients = 3
|
||||
minDatabases = 1
|
||||
maxDatabases = 3
|
||||
multiThreaded = false
|
||||
|
||||
[[test.workload]]
|
||||
name = 'ApiCorrectness'
|
||||
minKeyLength = 1
|
||||
maxKeyLength = 64
|
||||
minValueLength = 1
|
||||
maxValueLength = 1000
|
||||
maxKeysPerTransaction = 50
|
||||
initialSize = 100
|
||||
numRandomOperations = 100
|
||||
readExistingKeysRatio = 0.9
|
||||
|
||||
[[test.workload]]
|
||||
name = 'AtomicOpsCorrectness'
|
||||
initialSize = 0
|
||||
numRandomOperations = 100
|
||||
|
||||
[[test.workload]]
|
||||
name = 'WatchAndWait'
|
||||
initialSize = 0
|
||||
numRandomOperations = 10
|
|
@ -2456,6 +2456,9 @@ void MultiVersionApi::setNetworkOptionInternal(FDBNetworkOptions::Option option,
|
|||
} else if (option == FDBNetworkOptions::DISABLE_CLIENT_BYPASS) {
|
||||
MutexHolder holder(lock);
|
||||
ASSERT(!value.present() && !networkStartSetup);
|
||||
if (bypassMultiClientApi) {
|
||||
throw invalid_option();
|
||||
}
|
||||
disableBypass = true;
|
||||
bypassMultiClientApi = false;
|
||||
forwardOption = true;
|
||||
|
|
|
@ -2496,12 +2496,13 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional<StringRef> valu
|
|||
}
|
||||
break;
|
||||
}
|
||||
case FDBNetworkOptions::DISABLE_CLIENT_BYPASS:
|
||||
networkOptions.disableBypass = true;
|
||||
break;
|
||||
case FDBNetworkOptions::EXTERNAL_CLIENT:
|
||||
networkOptions.primaryClient = false;
|
||||
break;
|
||||
case FDBNetworkOptions::DISABLE_CLIENT_BYPASS:
|
||||
validateOptionValueNotPresent(value);
|
||||
networkOptions.disableBypass = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -6671,6 +6672,9 @@ void Transaction::setOption(FDBTransactionOptions::Option option, Optional<Strin
|
|||
|
||||
case FDBTransactionOptions::USE_GRV_CACHE:
|
||||
validateOptionValueNotPresent(value);
|
||||
if (apiVersionAtLeast(720) && !networkOptions.disableBypass) {
|
||||
throw invalid_option();
|
||||
}
|
||||
if (trState->numErrors == 0) {
|
||||
trState->options.useGrvCache = true;
|
||||
}
|
||||
|
@ -8768,7 +8772,6 @@ void sharedStateDelRef(DatabaseSharedState* ssPtr) {
|
|||
}
|
||||
|
||||
Future<DatabaseSharedState*> DatabaseContext::initSharedState() {
|
||||
ASSERT(networkOptions.disableBypass);
|
||||
ASSERT(!sharedStatePtr); // Don't re-initialize shared state if a pointer already exists
|
||||
DatabaseSharedState* newState = new DatabaseSharedState();
|
||||
// Increment refcount by 1 on creation to account for the one held in MultiVersionApi map
|
||||
|
@ -8780,7 +8783,6 @@ Future<DatabaseSharedState*> DatabaseContext::initSharedState() {
|
|||
}
|
||||
|
||||
void DatabaseContext::setSharedState(DatabaseSharedState* p) {
|
||||
ASSERT(networkOptions.disableBypass);
|
||||
ASSERT(p->protocolVersion == currentProtocolVersion());
|
||||
sharedStatePtr = p;
|
||||
sharedStatePtr->refCount++;
|
||||
|
|
|
@ -127,7 +127,7 @@ description is not currently required but encouraged.
|
|||
<Option name="enable_run_loop_profiling" code="71"
|
||||
description="Enables debugging feature to perform run loop profiling. Requires trace logging to be enabled. WARNING: this feature is not recommended for use in production." />
|
||||
<Option name="disable_client_bypass" code="72"
|
||||
description="This option makes it so that the multi-version API cannot be bypassed on the primary client."/>
|
||||
description="Prevents the multi-version client API from being disabled, even if no external clients are configured. This option is required to use GRV caching."/>
|
||||
<Option name="client_buggify_enable" code="80"
|
||||
description="Enable client buggify - will make requests randomly fail (intended for client testing)" />
|
||||
<Option name="client_buggify_disable" code="81"
|
||||
|
@ -305,7 +305,7 @@ description is not currently required but encouraged.
|
|||
<Option name="bypass_unreadable" code="1100"
|
||||
description="Allows ``get`` operations to read from sections of keyspace that have become unreadable because of versionstamp operations. These reads will view versionstamp operations as if they were set operations that did not fill in the versionstamp." />
|
||||
<Option name="use_grv_cache" code="1101"
|
||||
description="Allows this transaction to use cached GRV from the database context. Defaults to off. Upon first usage, starts a background updater to periodically update the cache to avoid stale read versions." />
|
||||
description="Allows this transaction to use cached GRV from the database context. Defaults to off. Upon first usage, starts a background updater to periodically update the cache to avoid stale read versions. The disable_client_bypass option must also be set." />
|
||||
<Option name="skip_grv_cache" code="1102"
|
||||
description="Specifically instruct this transaction to NOT use cached GRV. Primarily used for the read version cache's background updater to avoid attempting to read a cached entry in specific situations."
|
||||
hidden="true"/>
|
||||
|
|
|
@ -274,6 +274,9 @@ class TestConfig {
|
|||
if (attrib == "disableEncryption") {
|
||||
disableEncryption = strcmp(value.c_str(), "true") == 0;
|
||||
}
|
||||
if (attrib == "disableClientBypass") {
|
||||
disableClientBypass = strcmp(value.c_str(), "true") == 0;
|
||||
}
|
||||
if (attrib == "restartInfoLocation") {
|
||||
isFirstTestInRestart = true;
|
||||
}
|
||||
|
@ -334,6 +337,8 @@ public:
|
|||
// Set the maximum TLog version that can be selected for a test
|
||||
// Refer to FDBTypes.h::TLogVersion. Defaults to the maximum supported version.
|
||||
int maxTLogVersion = TLogVersion::MAX_SUPPORTED;
|
||||
// Disable bypassing multi-version client API. Required for use_grv_cache
|
||||
bool disableClientBypass = false;
|
||||
// Set true to simplify simulation configs for easier debugging
|
||||
bool simpleConfig = false;
|
||||
int extraMachineCountDC = 0;
|
||||
|
@ -393,6 +398,7 @@ public:
|
|||
.add("disableHostname", &disableHostname)
|
||||
.add("disableRemoteKVS", &disableRemoteKVS)
|
||||
.add("disableEncryption", &disableEncryption)
|
||||
.add("disableClientBypass", &disableClientBypass)
|
||||
.add("simpleConfig", &simpleConfig)
|
||||
.add("generateFearless", &generateFearless)
|
||||
.add("datacenters", &datacenters)
|
||||
|
@ -1150,6 +1156,10 @@ ACTOR Future<Void> restartSimulatedSystem(std::vector<Future<Void>>* systemActor
|
|||
g_knobs.setKnob("enable_blob_granule_encryption", KnobValueRef::create(bool{ false }));
|
||||
TraceEvent(SevDebug, "DisableEncryption");
|
||||
}
|
||||
if (testConfig.disableClientBypass) {
|
||||
setNetworkOption(FDBNetworkOptions::DISABLE_CLIENT_BYPASS);
|
||||
TraceEvent(SevDebug, "DisableClientBypass");
|
||||
}
|
||||
*pConnString = conn;
|
||||
*pTesterCount = testerCount;
|
||||
bool usingSSL = conn.toString().find(":tls") != std::string::npos || listenersPerProcess > 1;
|
||||
|
@ -1934,6 +1944,10 @@ void setupSimulatedSystem(std::vector<Future<Void>>* systemActors,
|
|||
g_knobs.setKnob("enable_blob_granule_encryption", KnobValueRef::create(bool{ false }));
|
||||
TraceEvent(SevDebug, "DisableEncryption");
|
||||
}
|
||||
if (testConfig.disableClientBypass) {
|
||||
setNetworkOption(FDBNetworkOptions::DISABLE_CLIENT_BYPASS);
|
||||
TraceEvent(SevDebug, "DisableClientBypass");
|
||||
}
|
||||
auto configDBType = testConfig.getConfigDBType();
|
||||
for (auto kv : startingConfigJSON) {
|
||||
if ("tss_storage_engine" == kv.first) {
|
||||
|
|
|
@ -1184,7 +1184,15 @@ std::map<std::string, std::function<void(const std::string&)>> testSpecGlobalKey
|
|||
{ "disableRemoteKVS",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedRemoteKVS", ""); } },
|
||||
{ "disableEncryption",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedRemoteKVS", ""); } }
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedRemoteKVS", ""); } },
|
||||
{ "disableClientBypass",
|
||||
[](const std::string& value) {
|
||||
if (value == "true") {
|
||||
setNetworkOption(FDBNetworkOptions::DISABLE_CLIENT_BYPASS);
|
||||
}
|
||||
// else { } It is disabled by default for tester
|
||||
TraceEvent("TestParserTest").detail("ParsedDisableClientBypass", "");
|
||||
} }
|
||||
};
|
||||
|
||||
std::map<std::string, std::function<void(const std::string& value, TestSpec* spec)>> testSpecTestKeys = {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[configuration]
|
||||
disableClientBypass=true
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SingleClientCausalConsistencyTest'
|
||||
|
||||
|
|
Loading…
Reference in New Issue