added new SimpleAtomicAdd workload and adjusted SnapIncrementalRestore restarting test
This commit is contained in:
parent
a78da8b3ce
commit
57a80cfef2
|
@ -189,6 +189,7 @@ set(FDBSERVER_SRCS
|
|||
workloads/SelectorCorrectness.actor.cpp
|
||||
workloads/Serializability.actor.cpp
|
||||
workloads/Sideband.actor.cpp
|
||||
workloads/SimpleAtomicAdd.actor.cpp
|
||||
workloads/SlowTaskWorkload.actor.cpp
|
||||
workloads/SnapTest.actor.cpp
|
||||
workloads/SpecialKeySpaceCorrectness.actor.cpp
|
||||
|
|
|
@ -97,7 +97,7 @@ struct IncrementalBackupWorkload : TestWorkload {
|
|||
wait(self->backupAgent.submitBackup(cx, self->backupDir, 1e8, self->tag.toString(), backupRanges, false,
|
||||
false, true));
|
||||
// Wait for backup container to be created and avoid race condition
|
||||
wait(delay(60.0));
|
||||
wait(delay(90.0));
|
||||
EBackupState waitResult = wait(self->backupAgent.waitBackup(cx, self->tag.toString(), false));
|
||||
TraceEvent("IBackupSubmitWaitResult").detail("Result", BackupAgentBase::getStateText(waitResult));
|
||||
} catch (Error& e) {
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* SimpleAtomicAdd.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 "fdbclient/ReadYourWrites.h"
|
||||
#include "fdbserver/workloads/workloads.actor.h"
|
||||
#include "flow/flow.h"
|
||||
#include "flow/genericactors.actor.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
struct SimpleAtomicAddWorkload : TestWorkload {
|
||||
int addValue;
|
||||
int iterations;
|
||||
bool initialize;
|
||||
int initialValue;
|
||||
Key sumKey;
|
||||
double testDuration;
|
||||
vector<Future<Void>> clients;
|
||||
|
||||
SimpleAtomicAddWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {
|
||||
testDuration = getOption(options, LiteralStringRef("testDuration"), 10.0);
|
||||
addValue = getOption(options, LiteralStringRef("addValue"), 1);
|
||||
iterations = getOption(options, LiteralStringRef("iterations"), 100);
|
||||
initialize = getOption(options, LiteralStringRef("initialize"), false);
|
||||
initialValue = getOption(options, LiteralStringRef("initialValue"), 0);
|
||||
sumKey = getOption(options, LiteralStringRef("sumKey"), LiteralStringRef("sumKey"));
|
||||
}
|
||||
|
||||
virtual std::string description() { return "SimpleAtomicAdd"; }
|
||||
|
||||
virtual Future<Void> setup(Database const& cx) { return Void(); }
|
||||
|
||||
virtual Future<Void> start(Database const& cx) {
|
||||
if (clientId) {
|
||||
return Void();
|
||||
}
|
||||
return _start(cx, this);
|
||||
}
|
||||
|
||||
virtual Future<bool> check(Database const& cx) {
|
||||
if (clientId) {
|
||||
return true;
|
||||
}
|
||||
return _check(cx, this);
|
||||
}
|
||||
|
||||
ACTOR static Future<Void> _start(Database cx, SimpleAtomicAddWorkload* self) {
|
||||
if (self->initialize) {
|
||||
wait(setInitialValue(cx, self));
|
||||
}
|
||||
for (int i = 0; i < self->iterations; ++i) {
|
||||
self->clients.push_back(timeout(applyAtomicAdd(cx, self), self->testDuration, Void()));
|
||||
}
|
||||
waitForAll(self->clients);
|
||||
return Void();
|
||||
}
|
||||
|
||||
ACTOR static Future<Void> setInitialValue(Database cx, SimpleAtomicAddWorkload* self) {
|
||||
state ReadYourWritesTransaction tr(cx);
|
||||
state Value val = StringRef((const uint8_t*)&self->initialValue, sizeof(self->initialValue));
|
||||
loop {
|
||||
try {
|
||||
TraceEvent("SimpleAtomicAddSetInitialValue").detail("Key", self->sumKey).detail("Value", val);
|
||||
tr.set(self->sumKey, val);
|
||||
wait(tr.commit());
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
TraceEvent("SimpleAtomicAddSetInitialValueError").error(e);
|
||||
wait(tr.onError(e));
|
||||
}
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
ACTOR static Future<Void> applyAtomicAdd(Database cx, SimpleAtomicAddWorkload* self) {
|
||||
state ReadYourWritesTransaction tr(cx);
|
||||
state Value val = StringRef((const uint8_t*)&self->addValue, sizeof(self->addValue));
|
||||
loop {
|
||||
try {
|
||||
TraceEvent("SimpleAtomicAddBegin").detail("Key", self->sumKey).detail("Value", val);
|
||||
tr.atomicOp(self->sumKey, val, MutationRef::AddValue);
|
||||
wait(tr.commit());
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
TraceEvent("SimpleAtomicAddError").error(e);
|
||||
wait(tr.onError(e));
|
||||
}
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
ACTOR static Future<bool> _check(Database cx, SimpleAtomicAddWorkload* self) {
|
||||
state ReadYourWritesTransaction tr(cx);
|
||||
state uint64_t expectedValue = self->addValue * self->iterations;
|
||||
if (self->initialize) {
|
||||
expectedValue += self->initialValue;
|
||||
}
|
||||
Optional<Value> actualValue = wait(tr.get(self->sumKey));
|
||||
uint64_t actualValueInt = 0;
|
||||
if (actualValue.present()) {
|
||||
memcpy(&actualValueInt, actualValue.get().begin(), actualValue.get().size());
|
||||
}
|
||||
TraceEvent("SimpleAtomicAddCheck").detail("ExpectedValue", expectedValue).detail("ActualValue", actualValueInt);
|
||||
return (expectedValue == actualValueInt);
|
||||
}
|
||||
|
||||
virtual void getMetrics(vector<PerfMetric>& m) {}
|
||||
};
|
||||
|
||||
WorkloadFactory<SimpleAtomicAddWorkload> SimpleAtomicAddWorkloadFactory("SimpleAtomicAdd");
|
|
@ -195,21 +195,6 @@ public: // workload functions
|
|||
// create even keys before the snapshot
|
||||
wait(self->_create_keys(cx, "snapKey"));
|
||||
} else if (self->testID == 1) {
|
||||
state Reference<ReadYourWritesTransaction> tr1(new ReadYourWritesTransaction(cx));
|
||||
loop {
|
||||
try {
|
||||
tr1->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
|
||||
tr1->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
state Optional<Value> val = wait(tr1->get(writeRecoveryKey));
|
||||
state Optional<Value> val2 = wait(tr1->get(snapshotEndVersionKey));
|
||||
TraceEvent("CheckSpecialKey1")
|
||||
.detail("WriteRecoveryValue", val.present() ? val.get().toString() : "N/A")
|
||||
.detail("EndVersionValue", val2.present() ? val2.get().toString() : "N/A");
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
wait(tr1->onError(e));
|
||||
}
|
||||
}
|
||||
// create a snapshot
|
||||
state double toDelay = fmod(deterministicRandom()->randomUInt32(), self->maxSnapDelay);
|
||||
TraceEvent("ToDelay").detail("Value", toDelay);
|
||||
|
@ -237,21 +222,6 @@ public: // workload functions
|
|||
}
|
||||
}
|
||||
}
|
||||
state Reference<ReadYourWritesTransaction> tr2(new ReadYourWritesTransaction(cx));
|
||||
loop {
|
||||
try {
|
||||
tr2->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
|
||||
tr2->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
state Optional<Value> val3 = wait(tr2->get(writeRecoveryKey));
|
||||
state Optional<Value> val4 = wait(tr2->get(snapshotEndVersionKey));
|
||||
TraceEvent("CheckSpecialKey2")
|
||||
.detail("WriteRecoveryValue", val3.present() ? val3.get().toString() : "N/A")
|
||||
.detail("EndVersionValue", val4.present() ? val4.get().toString() : "N/A");
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
wait(tr2->onError(e));
|
||||
}
|
||||
}
|
||||
CSimpleIni ini;
|
||||
ini.SetUnicode();
|
||||
ini.LoadFile(self->restartInfoLocation.c_str());
|
||||
|
@ -274,21 +244,6 @@ public: // workload functions
|
|||
TraceEvent(SevWarnAlways, "BackupFailedSkippingRestoreCheck");
|
||||
return Void();
|
||||
}
|
||||
state Reference<ReadYourWritesTransaction> tr3(new ReadYourWritesTransaction(cx));
|
||||
loop {
|
||||
try {
|
||||
tr3->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
|
||||
tr3->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
state Optional<Value> val5 = wait(tr3->get(writeRecoveryKey));
|
||||
state Optional<Value> val6 = wait(tr3->get(snapshotEndVersionKey));
|
||||
TraceEvent("CheckSpecialKey3")
|
||||
.detail("WriteRecoveryValue", val5.present() ? val5.get().toString() : "N/A")
|
||||
.detail("EndVersionValue", val6.present() ? val6.get().toString() : "N/A");
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
wait(tr3->onError(e));
|
||||
}
|
||||
}
|
||||
state KeySelector begin = firstGreaterOrEqual(normalKeys.begin);
|
||||
state KeySelector end = firstGreaterOrEqual(normalKeys.end);
|
||||
state int cnt = 0;
|
||||
|
|
|
@ -137,6 +137,7 @@ if(WITH_PYTHON)
|
|||
add_fdb_test(TEST_FILES fast/SelectorCorrectness.toml)
|
||||
add_fdb_test(TEST_FILES fast/Sideband.toml)
|
||||
add_fdb_test(TEST_FILES fast/SidebandWithStatus.toml)
|
||||
add_fdb_test(TEST_FILES fast/SimpleAtomicAdd.toml)
|
||||
add_fdb_test(TEST_FILES fast/SpecialKeySpaceCorrectness.toml)
|
||||
add_fdb_test(TEST_FILES fast/SwizzledRollbackSideband.toml)
|
||||
add_fdb_test(TEST_FILES fast/SystemRebootTestCycle.toml)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[[test]]
|
||||
testTitle = 'SimpleAtomicAdd'
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'SimpleAtomicAdd'
|
||||
initialize = true
|
||||
initialValue = 15
|
||||
iterations = 200
|
||||
addValue = 10
|
|
@ -1,6 +1,17 @@
|
|||
[[test]]
|
||||
testTitle = 'PresetValue'
|
||||
clearAfterTest = false
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'SimpleAtomicAdd'
|
||||
initialize = true
|
||||
initialValue = 0
|
||||
iterations = 0
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SubmitBackup'
|
||||
simBackupAgents = 'BackupToFile'
|
||||
clearAfterTest = false
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'IncrementalBackup'
|
||||
|
@ -8,7 +19,14 @@ simBackupAgents = 'BackupToFile'
|
|||
submitOnly = true
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SnapRunWorkloads'
|
||||
testTitle = 'PreSnapWorkloads'
|
||||
clearAfterTest = false
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'SimpleAtomicAdd'
|
||||
|
||||
[[test]]
|
||||
testTitle = 'TakeSnap'
|
||||
clearAfterTest = false
|
||||
|
||||
[[test.workload]]
|
||||
|
@ -17,23 +35,22 @@ clearAfterTest = false
|
|||
maxSnapDelay = 10.0
|
||||
testID = 1
|
||||
|
||||
|
||||
[[test]]
|
||||
testTitle = 'PostSnapWorkloads'
|
||||
clearAfterTest = true
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'Cycle'
|
||||
nodeCount = 3000
|
||||
transactionsPerSecond = 3000.0
|
||||
testDuration = 20.0
|
||||
testDuration = 10.0
|
||||
expectedRate = 0
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SnapPostWorkloads'
|
||||
clearAfterTest = false
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'AtomicOps'
|
||||
transactionsPerSecond = 2500.0
|
||||
testDuration = 20.0
|
||||
opType = 0
|
||||
nodeCount = 1000
|
||||
testName = 'IncrementalBackup'
|
||||
tag = 'default'
|
||||
waitForBackup = true
|
||||
|
||||
[[test]]
|
||||
testTitle = 'SnapShutdown'
|
||||
|
@ -41,4 +58,5 @@ testTitle = 'SnapShutdown'
|
|||
[[test.workload]]
|
||||
testName = 'SaveAndKill'
|
||||
restartInfoLocation = 'simfdb/restartInfo.ini'
|
||||
testDuration = 10.0
|
||||
testDuration = 10.0
|
||||
isRestoring = 1
|
|
@ -21,8 +21,4 @@ checkOnly = true
|
|||
expectedRate = 0
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'AtomicOps'
|
||||
transactionsPerSecond = 2500.0
|
||||
testDuration = 10.0
|
||||
opType = 0
|
||||
nodeCount = 1000
|
||||
testName = 'SimpleAtomicAdd'
|
||||
|
|
Loading…
Reference in New Issue