mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-23 23:59:58 +08:00
Merge pull request #5154 from sfc-gh-tclinkenbeard/send-serverdbinfo-updates-to-coord
Add LowLatencySingleClog test
This commit is contained in:
commit
f914574f47
fdbrpc
fdbserver
tests
@ -1950,6 +1950,7 @@ public:
|
||||
g_clogging.clogRecvFor(ip, seconds);
|
||||
}
|
||||
void clogPair(const IPAddress& from, const IPAddress& to, double seconds) override {
|
||||
TraceEvent("CloggingPair").detail("From", from).detail("To", to).detail("Seconds", seconds);
|
||||
g_clogging.clogPairFor(from, to, seconds);
|
||||
}
|
||||
std::vector<ProcessInfo*> getAllProcesses() const override {
|
||||
|
@ -146,7 +146,7 @@ set(FDBSERVER_SRCS
|
||||
workloads/BackgroundSelectors.actor.cpp
|
||||
workloads/BackupCorrectness.actor.cpp
|
||||
workloads/BackupAndParallelRestoreCorrectness.actor.cpp
|
||||
workloads/ParallelRestore.actor.cpp
|
||||
workloads/ClogSingleConnection.actor.cpp
|
||||
workloads/BackupToBlob.actor.cpp
|
||||
workloads/BackupToDBAbort.actor.cpp
|
||||
workloads/BackupToDBCorrectness.actor.cpp
|
||||
@ -197,6 +197,7 @@ set(FDBSERVER_SRCS
|
||||
workloads/MemoryKeyValueStore.h
|
||||
workloads/MemoryLifetime.actor.cpp
|
||||
workloads/MetricLogging.actor.cpp
|
||||
workloads/ParallelRestore.actor.cpp
|
||||
workloads/Performance.actor.cpp
|
||||
workloads/Ping.actor.cpp
|
||||
workloads/PopulateTPCC.actor.cpp
|
||||
|
@ -234,6 +234,15 @@ vector<std::string> getOption(VectorRef<KeyValueRef> options, Key key, vector<st
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
bool hasOption(VectorRef<KeyValueRef> options, Key key) {
|
||||
for (const auto& option : options) {
|
||||
if (option.key == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns unconsumed options
|
||||
Standalone<VectorRef<KeyValueRef>> checkAllOptionsConsumed(VectorRef<KeyValueRef> options) {
|
||||
static StringRef nothing = LiteralStringRef("");
|
||||
|
71
fdbserver/workloads/ClogSingleConnection.actor.cpp
Normal file
71
fdbserver/workloads/ClogSingleConnection.actor.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* ClogSingleConnection.actor.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/NativeAPI.actor.h"
|
||||
#include "fdbserver/TesterInterface.actor.h"
|
||||
#include "fdbserver/workloads/workloads.actor.h"
|
||||
#include "fdbrpc/simulator.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
class ClogSingleConnectionWorkload : public TestWorkload {
|
||||
double delaySeconds;
|
||||
Optional<double> clogDuration; // If empty, clog forever
|
||||
|
||||
public:
|
||||
ClogSingleConnectionWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {
|
||||
auto minDelay = getOption(options, "minDelay"_sr, 0.0);
|
||||
auto maxDelay = getOption(options, "maxDelay"_sr, 10.0);
|
||||
ASSERT_LE(minDelay, maxDelay);
|
||||
delaySeconds = minDelay + deterministicRandom()->random01() * (maxDelay - minDelay);
|
||||
if (hasOption(options, "clogDuration"_sr)) {
|
||||
clogDuration = getOption(options, "clogDuration"_sr, "");
|
||||
}
|
||||
}
|
||||
|
||||
std::string description() const override {
|
||||
return g_network->isSimulated() ? "ClogSingleConnection" : "NoClogging";
|
||||
}
|
||||
Future<Void> setup(Database const& cx) override { return Void(); }
|
||||
|
||||
Future<Void> start(Database const& cx) override {
|
||||
if (g_network->isSimulated() && clientId == 0) {
|
||||
return map(delay(delaySeconds), [this](Void _) {
|
||||
clogRandomPair();
|
||||
return Void();
|
||||
});
|
||||
} else {
|
||||
return Void();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> check(Database const& cx) override { return true; }
|
||||
|
||||
void getMetrics(std::vector<PerfMetric>& m) override {}
|
||||
|
||||
void clogRandomPair() {
|
||||
auto m1 = deterministicRandom()->randomChoice(g_simulator.getAllProcesses());
|
||||
auto m2 = deterministicRandom()->randomChoice(g_simulator.getAllProcesses());
|
||||
if (m1->address.ip != m2->address.ip) {
|
||||
g_simulator.clogPair(m1->address.ip, m2->address.ip, clogDuration.orDefault(10000));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WorkloadFactory<ClogSingleConnectionWorkload> ClogSingleConnectionWorkloadFactory("ClogSingleConnection");
|
@ -43,6 +43,7 @@ bool getOption(VectorRef<KeyValueRef> options, Key key, bool defaultValue);
|
||||
vector<std::string> getOption(VectorRef<KeyValueRef> options,
|
||||
Key key,
|
||||
vector<std::string> defaultValue); // comma-separated strings
|
||||
bool hasOption(VectorRef<KeyValueRef> options, Key key);
|
||||
|
||||
struct WorkloadContext {
|
||||
Standalone<VectorRef<KeyValueRef>> options;
|
||||
@ -53,9 +54,7 @@ struct WorkloadContext {
|
||||
WorkloadContext();
|
||||
WorkloadContext(const WorkloadContext&);
|
||||
~WorkloadContext();
|
||||
|
||||
private:
|
||||
void operator=(const WorkloadContext&);
|
||||
WorkloadContext& operator=(const WorkloadContext&) = delete;
|
||||
};
|
||||
|
||||
struct TestWorkload : NonCopyable, WorkloadContext {
|
||||
|
@ -134,6 +134,8 @@ if(WITH_PYTHON)
|
||||
add_fdb_test(TEST_FILES fast/LocalRatekeeper.toml)
|
||||
add_fdb_test(TEST_FILES fast/LongStackWriteDuringRead.toml)
|
||||
add_fdb_test(TEST_FILES fast/LowLatency.toml)
|
||||
# TODO: Fix failures and reenable this test:
|
||||
add_fdb_test(TEST_FILES fast/LowLatencySingleClog.toml IGNORE)
|
||||
add_fdb_test(TEST_FILES fast/MemoryLifetime.toml)
|
||||
add_fdb_test(TEST_FILES fast/MoveKeysCycle.toml)
|
||||
add_fdb_test(TEST_FILES fast/ProtocolVersion.toml)
|
||||
|
20
tests/fast/LowLatencySingleClog.toml
Normal file
20
tests/fast/LowLatencySingleClog.toml
Normal file
@ -0,0 +1,20 @@
|
||||
[configuration]
|
||||
buggify = false
|
||||
minimumReplication = 2
|
||||
|
||||
[[test]]
|
||||
testTitle = 'Clogged'
|
||||
connectionFailuresDisableDuration = 100000
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'Cycle'
|
||||
transactionsPerSecond = 1000.0
|
||||
testDuration = 30.0
|
||||
expectedRate = 0
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'LowLatency'
|
||||
testDuration = 30.0
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'ClogSingleConnection'
|
Loading…
x
Reference in New Issue
Block a user