Merge pull request #3847 from sfc-gh-tclinkenbeard/refactor-workloads

Modernize TestWorkload overrides
This commit is contained in:
Andrew Noyes 2020-10-14 15:07:03 -07:00 committed by GitHub
commit b2d9b93243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 549 additions and 846 deletions

View File

@ -58,8 +58,8 @@ struct PerfIntCounter {
PerfIntCounter(std::string name, vector<PerfIntCounter*>& v) : name(name), value(0) { v.push_back(this); }
void operator += (int64_t delta) { value += delta; }
void operator ++ () { value += 1; }
PerfMetric getMetric() { return PerfMetric( name, (double)value, false, "%.0lf" ); }
int64_t getValue() { return value; }
PerfMetric getMetric() const { return PerfMetric(name, static_cast<double>(value), false, "%.0lf"); }
int64_t getValue() const { return value; }
void clear() { value = 0; }
private:
@ -72,8 +72,8 @@ struct PerfDoubleCounter {
PerfDoubleCounter(std::string name, vector<PerfDoubleCounter*>& v) : name(name), value(0) { v.push_back(this); }
void operator += (double delta) { value += delta; }
void operator ++ () { value += 1.0; }
PerfMetric getMetric() { return PerfMetric( name, value, false ); }
double getValue() { return value; }
PerfMetric getMetric() const { return PerfMetric(name, value, false); }
double getValue() const { return value; }
void clear() { value = 0.0; }
private:

View File

@ -78,11 +78,11 @@ Key doubleToTestKey(double p, const KeyRef& prefix) {
return doubleToTestKey(p).withPrefix(prefix);
}
Key KVWorkload::getRandomKey() {
Key KVWorkload::getRandomKey() const {
return getRandomKey(absentFrac);
}
Key KVWorkload::getRandomKey(double absentFrac) {
Key KVWorkload::getRandomKey(double absentFrac) const {
if ( absentFrac > 0.0000001 ) {
return getRandomKey(deterministicRandom()->random01() < absentFrac);
} else {
@ -90,11 +90,11 @@ Key KVWorkload::getRandomKey(double absentFrac) {
}
}
Key KVWorkload::getRandomKey(bool absent) {
Key KVWorkload::getRandomKey(bool absent) const {
return keyForIndex(deterministicRandom()->randomInt( 0, nodeCount ), absent);
}
Key KVWorkload::keyForIndex( uint64_t index ) {
Key KVWorkload::keyForIndex(uint64_t index) const {
if ( absentFrac > 0.0000001 ) {
return keyForIndex(index, deterministicRandom()->random01() < absentFrac);
} else {
@ -102,7 +102,7 @@ Key KVWorkload::keyForIndex( uint64_t index ) {
}
}
Key KVWorkload::keyForIndex( uint64_t index, bool absent ) {
Key KVWorkload::keyForIndex(uint64_t index, bool absent) const {
int adjustedKeyBytes = (absent) ? (keyBytes + 1) : keyBytes;
Key result = makeString( adjustedKeyBytes );
uint8_t* data = mutateString( result );
@ -254,32 +254,34 @@ struct CompoundWorkload : TestWorkload {
CompoundWorkload( WorkloadContext& wcx ) : TestWorkload( wcx ) {}
CompoundWorkload* add( TestWorkload* w ) { workloads.push_back(w); return this; }
virtual ~CompoundWorkload() { for(int w=0; w<workloads.size(); w++) delete workloads[w]; }
virtual std::string description() {
~CompoundWorkload() {
for (int w = 0; w < workloads.size(); w++) delete workloads[w];
}
std::string description() const override {
std::string d;
for(int w=0; w<workloads.size(); w++)
d += workloads[w]->description() + (w==workloads.size()-1?"":";");
return d;
}
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
vector<Future<Void>> all;
for(int w=0; w<workloads.size(); w++)
all.push_back( workloads[w]->setup(cx) );
return waitForAll(all);
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
vector<Future<Void>> all;
for(int w=0; w<workloads.size(); w++)
all.push_back( workloads[w]->start(cx) );
return waitForAll(all);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
vector<Future<bool>> all;
for(int w=0; w<workloads.size(); w++)
all.push_back( workloads[w]->check(cx) );
return allTrue(all);
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
for(int w=0; w<workloads.size(); w++) {
vector<PerfMetric> p;
workloads[w]->getMetrics(p);
@ -287,7 +289,7 @@ struct CompoundWorkload : TestWorkload {
m.push_back( p[i].withPrefix( workloads[w]->description()+"." ) );
}
}
virtual double getCheckTimeout() {
double getCheckTimeout() const override {
double m = 0;
for(int w=0; w<workloads.size(); w++)
m = std::max( workloads[w]->getCheckTimeout(), m );

View File

@ -122,11 +122,9 @@ public:
virtual ~ApiCorrectnessWorkload(){ }
std::string description() {
return "ApiCorrectness";
}
std::string description() const override { return "ApiCorrectness"; }
void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back(PerfMetric("Number of Random Operations Performed", numRandomOperations.getValue(), false));
}

View File

@ -285,9 +285,9 @@ struct ApiWorkload : TestWorkload {
}
}
Future<Void> setup(Database const& cx);
Future<Void> start(Database const& cx);
Future<bool> check(Database const& cx);
Future<Void> setup(Database const& cx) override;
Future<Void> start(Database const& cx) override;
Future<bool> check(Database const& cx) override;
//Compares the contents of this client's key-space in the database with the in-memory key-value store
Future<bool> compareDatabaseToMemory();

View File

@ -97,13 +97,9 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload
virtual ~AsyncFileCorrectnessWorkload(){ }
virtual std::string description()
{
return "AsyncFileCorrectness";
}
std::string description() const override { return "AsyncFileCorrectness"; }
Future<Void> setup(Database const& cx)
{
Future<Void> setup(Database const& cx) override {
if(enabled)
return _setup(this);
@ -147,8 +143,7 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload
fileSize = newFileSize;
}
Future<Void> start(Database const& cx)
{
Future<Void> start(Database const& cx) override {
if(enabled)
return _start(this);
@ -371,8 +366,7 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload
//Checks if a file is already locked for a given set of bytes. The file is locked if it is being written (fileLock[i] = 0xFFFFFFFF)
//or if we are trying to perform a write and the read count is nonzero (fileLock[i] != 0)
bool checkFileLocked(int operation, int offset, int length)
{
bool checkFileLocked(int operation, int offset, int length) const {
for(int i = offset; i < offset + length && i < fileLock.size(); i++)
if(fileLock[i] == 0xFFFFFFFF || (fileLock[i] != 0 && operation == WRITE))
return true;
@ -381,8 +375,7 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload
}
//Populates a buffer with a random sequence of bytes
void generateRandomData(unsigned char *buffer, int length)
{
void generateRandomData(unsigned char* buffer, int length) const {
for(int i = 0; i < length; i+= sizeof(uint32_t))
{
uint32_t val = deterministicRandom()->randomUInt32();
@ -491,13 +484,9 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload
return info;
}
virtual Future<bool> check(Database const& cx)
{
return success;
}
Future<bool> check(Database const& cx) override { return success; }
virtual void getMetrics(vector<PerfMetric>& m)
{
void getMetrics(vector<PerfMetric>& m) override {
if(enabled)
{
m.push_back(PerfMetric("Number of Operations Performed", numOperations.getValue(), false));

View File

@ -182,13 +182,9 @@ struct AsyncFileReadWorkload : public AsyncFileWorkload
virtual ~AsyncFileReadWorkload(){ }
virtual std::string description()
{
return "AsyncFileRead";
}
std::string description() const override { return "AsyncFileRead"; }
virtual Future<Void> setup(Database const& cx)
{
Future<Void> setup(Database const& cx) override {
if(enabled)
return _setup(this);
@ -213,8 +209,7 @@ struct AsyncFileReadWorkload : public AsyncFileWorkload
return Void();
}
virtual Future<Void> start(Database const& cx)
{
Future<Void> start(Database const& cx) override {
if(enabled)
return _start(this);
@ -335,7 +330,7 @@ struct AsyncFileReadWorkload : public AsyncFileWorkload
}
}
virtual void getMetrics(std::vector<PerfMetric>& m) {
void getMetrics(std::vector<PerfMetric>& m) override {
if (enabled) {
m.emplace_back("Bytes read/sec", bytesRead.getValue() / testDuration, false);
m.emplace_back("Average CPU Utilization (Percentage)", averageCpuUtilization * 100, false);

View File

@ -54,15 +54,9 @@ struct AsyncFileWriteWorkload : public AsyncFileWorkload
sequential = getOption(options, LiteralStringRef("sequential"), true);
}
virtual ~AsyncFileWriteWorkload(){ }
std::string description() const override { return "AsyncFileWrite"; }
virtual std::string description()
{
return "AsyncFileWrite";
}
virtual Future<Void> setup(Database const& cx)
{
Future<Void> setup(Database const& cx) override {
if(enabled)
return _setup(this);
@ -91,8 +85,7 @@ struct AsyncFileWriteWorkload : public AsyncFileWorkload
return Void();
}
virtual Future<Void> start(Database const& cx)
{
Future<Void> start(Database const& cx) override {
if(enabled)
return _start(this);
@ -162,8 +155,7 @@ struct AsyncFileWriteWorkload : public AsyncFileWorkload
}
}
virtual void getMetrics(vector<PerfMetric>& m)
{
void getMetrics(vector<PerfMetric>& m) override {
if(enabled)
{
m.push_back(PerfMetric("Bytes written/sec", bytesWritten.getValue() / testDuration, false));

View File

@ -108,9 +108,9 @@ struct AtomicOpsWorkload : TestWorkload {
TraceEvent("AtomicWorkload").detail("OpType", opType);
}
virtual std::string description() { return "AtomicOps"; }
std::string description() const override { return "AtomicOps"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
if (apiVersion500)
cx->apiVersion = 500;
@ -119,7 +119,7 @@ struct AtomicOpsWorkload : TestWorkload {
return _setup( cx, this );
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
for (int c = 0; c < actorCount; c++) {
clients.push_back(
timeout(atomicOpWorker(cx->clone(), this, actorCount / transactionsPerSecond), testDuration, Void()));
@ -128,14 +128,13 @@ struct AtomicOpsWorkload : TestWorkload {
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
if(clientId != 0)
return true;
return _check( cx, this );
}
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
std::pair<Key, Key> logDebugKey(int group) {
Key logKey(format("log%08x%08x%08x", group, clientId, opNum));

View File

@ -49,13 +49,11 @@ public:
opType = getOption(options, LiteralStringRef("opType"), -1);
}
virtual std::string description() { return "AtomicOpsApiCorrectness"; }
std::string description() const override { return "AtomicOpsApiCorrectness"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (opType == -1)
opType = sharedRandomNumber % 9;
@ -94,12 +92,9 @@ public:
return Void();
}
virtual Future<bool> check(Database const& cx) {
return !testFailed;
}
Future<bool> check(Database const& cx) override { return !testFailed; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
virtual void getMetrics(vector<PerfMetric>& m) override {}
// Test Atomic ops on non existing keys that results in a set
ACTOR Future<Void> testAtomicOpSetOnNonExistingKey(Database cx, AtomicOpsApiCorrectnessWorkload* self, uint32_t opType, Key key) {

View File

@ -68,28 +68,21 @@ struct AtomicRestoreWorkload : TestWorkload {
ASSERT(removePrefix.size() == 0);
}
virtual std::string description() {
return "AtomicRestore";
}
std::string description() const override { return "AtomicRestore"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
bool hasPrefix() { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); }
bool hasPrefix() const { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); }
ACTOR static Future<Void> _start(Database cx, AtomicRestoreWorkload* self) {
state FileBackupAgent backupAgent;

View File

@ -43,11 +43,9 @@ struct AtomicSwitchoverWorkload : TestWorkload {
extraDB = Database::createDatabase(extraFile, -1);
}
virtual std::string description() {
return "AtomicSwitchover";
}
std::string description() const override { return "AtomicSwitchover"; }
virtual Future<Void> setup(Database const& cx) {
Future<Void> setup(Database const& cx) override {
if (clientId != 0)
return Void();
return _setup(cx, this);
@ -66,18 +64,15 @@ struct AtomicSwitchoverWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> diffRanges(Standalone<VectorRef<KeyRangeRef>> ranges, StringRef backupPrefix, Database src, Database dest) {
state int rangeIndex;

View File

@ -49,15 +49,11 @@ struct BackgroundSelectorWorkload : TestWorkload {
resultLimit = 10*maxDiff;
}
virtual std::string description() { return "BackgroundSelector"; }
std::string description() const override { return "BackgroundSelector"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
return _start( cx, this );
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start( Database cx, BackgroundSelectorWorkload *self ) {
for(int c=0; c<self->actorsPerClient; c++)
@ -68,7 +64,7 @@ struct BackgroundSelectorWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
bool ok = true;
for( int i = 0; i < clients.size(); i++ )
if( clients[i].isError() )
@ -77,7 +73,7 @@ struct BackgroundSelectorWorkload : TestWorkload {
return ok;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
double duration = testDuration;
m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) );
m.push_back( operations.getMetric() );

View File

@ -136,11 +136,11 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
}
}
virtual std::string description() { return "BackupAndParallelRestoreCorrectness"; }
std::string description() const override { return "BackupAndParallelRestoreCorrectness"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0) return Void();
TraceEvent(SevInfo, "BARW_Param").detail("Locked", locked);
@ -158,11 +158,11 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload {
return _start(cx, this);
}
bool hasPrefix() { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); }
bool hasPrefix() const { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); }
virtual Future<bool> check(Database const& cx) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> changePaused(Database cx, FileBackupAgent* backupAgent) {
loop {

View File

@ -118,15 +118,11 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
}
}
virtual std::string description() {
return "BackupAndRestoreCorrectness";
}
std::string description() const override { return "BackupAndRestoreCorrectness"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
@ -145,7 +141,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId != 0)
return true;
else
@ -175,8 +171,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload {
return true;
}
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> changePaused(Database cx, FileBackupAgent* backupAgent) {
loop {

View File

@ -42,11 +42,9 @@ struct BackupToDBAbort : TestWorkload {
lockid = UID(0xbeeffeed, 0xdecaf00d);
}
virtual std::string description() override {
return "BackupToDBAbort";
}
std::string description() const override { return "BackupToDBAbort"; }
virtual Future<Void> setup(const Database& cx) override {
Future<Void> setup(const Database& cx) override {
if (clientId != 0) return Void();
return _setup(this, cx);
}
@ -64,7 +62,7 @@ struct BackupToDBAbort : TestWorkload {
return Void();
}
virtual Future<Void> start(Database const& cx) override {
Future<Void> start(Database const& cx) override {
if (clientId != 0) return Void();
return _start(this, cx);
}
@ -100,11 +98,9 @@ struct BackupToDBAbort : TestWorkload {
return true;
}
virtual Future<bool> check(const Database& cx) override {
return _check(this, cx);
}
Future<bool> check(const Database& cx) override { return _check(this, cx); }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
REGISTER_WORKLOAD(BackupToDBAbort);

View File

@ -109,26 +109,19 @@ struct BackupToDBCorrectnessWorkload : TestWorkload {
TraceEvent("BARW_Start").detail("Locked", locked);
}
virtual std::string description() {
return "BackupToDBCorrectness";
}
std::string description() const override { return "BackupToDBCorrectness"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> diffRanges(Standalone<VectorRef<KeyRangeRef>> ranges, StringRef backupPrefix, Database src, Database dest) {
state int rangeIndex;

View File

@ -74,28 +74,23 @@ struct BackupToDBUpgradeWorkload : TestWorkload {
TraceEvent("DRU_Start");
}
virtual std::string description() {
return "BackupToDBUpgrade";
}
virtual std::string description() const override { return "BackupToDBUpgrade"; }
virtual Future<Void> setup(Database const& cx) {
Future<Void> setup(Database const& cx) override {
if (clientId != 0)
return Void();
return _setup(cx, this);
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> doBackup(BackupToDBUpgradeWorkload* self, DatabaseBackupAgent* backupAgent, Database cx, Key tag, Standalone<VectorRef<KeyRangeRef>> backupRanges) {
try {

View File

@ -49,20 +49,20 @@ struct BulkLoadWorkload : TestWorkload {
keyPrefix = unprintable( keyPrefix.toString() );
}
virtual std::string description() { return "BulkLoad"; }
std::string description() const override { return "BulkLoad"; }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
for(int c = 0; c < actorCount; c++)
clients.push_back( timeout( bulkLoadClient( cx, this, clientId, c ), testDuration, Void() ) );
return waitForAll( clients );
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
m.push_back( PerfMetric( "Rows written", transactions.getValue() * writesPerTransaction, false ) );

View File

@ -12,22 +12,17 @@ struct CacheWorkload : TestWorkload {
keyPrefix = unprintable( getOption(options, LiteralStringRef("keyPrefix"), LiteralStringRef("")).toString() );
}
virtual std::string description() { return "CacheWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
if (clientId == 0) {
//Call management API to cache keys under the given prefix
return addCachedRange(cx, prefixRange(keyPrefix));
}
return Void();
}
virtual Future<Void> start( Database const& cx ) {
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
std::string description() const override { return "CacheWorkload"; }
Future<Void> setup(Database const& cx) override {
if (clientId == 0) {
// Call management API to cache keys under the given prefix
return addCachedRange(cx, prefixRange(keyPrefix));
}
return Void();
}
Future<Void> start(Database const& cx) override { return Void(); }
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<CacheWorkload> CacheWorkloadFactory("Cache");

View File

@ -41,18 +41,16 @@ struct ChangeConfigWorkload : TestWorkload {
networkAddresses = getOption( options, LiteralStringRef("coordinators"), StringRef() ).toString();
}
virtual std::string description() { return "ChangeConfig"; }
std::string description() const override { return "ChangeConfig"; }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( this->clientId != 0 ) return Void();
return ChangeConfigClient( cx->clone(), this );
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> extraDatabaseConfigure(ChangeConfigWorkload *self) {
if (g_network->isSimulated() && g_simulator.extraDB) {

View File

@ -184,9 +184,9 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
TraceEvent(SevInfo, "ClientTransactionProfilingSetup").detail("ClientId", clientId).detail("SamplingProbability", samplingProbability).detail("TrInfoSizeLimit", trInfoSizeLimit);
}
virtual std::string description() { return "ClientTransactionProfileCorrectness"; }
std::string description() const override { return "ClientTransactionProfileCorrectness"; }
virtual Future<Void> setup(Database const& cx) {
Future<Void> setup(Database const& cx) override {
if (clientId == 0) {
const_cast<ClientKnobs *>(CLIENT_KNOBS)->CSI_STATUS_DELAY = 2.0; // 2 seconds
return changeProfilingParameters(cx, trInfoSizeLimit, samplingProbability);
@ -194,21 +194,17 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start(Database const& cx) {
return Void();
}
Future<Void> start(Database const& cx) override { return Void(); }
int getNumChunks(KeyRef key) {
int getNumChunks(KeyRef key) const {
return bigEndian32(BinaryReader::fromStringRef<int>(key.substr(numChunksStartIndex, chunkFormatSize), Unversioned()));
}
int getChunkNum(KeyRef key) {
int getChunkNum(KeyRef key) const {
return bigEndian32(BinaryReader::fromStringRef<int>(key.substr(chunkNumStartIndex, chunkFormatSize), Unversioned()));
}
std::string getTrId(KeyRef key) {
return key.substr(trIdStartIndex, trIdFormatSize).toString();
}
std::string getTrId(KeyRef key) const { return key.substr(trIdStartIndex, trIdFormatSize).toString(); }
bool checkTxInfoEntriesFormat(const Standalone<RangeResultRef> &txInfoEntries) {
std::string val;
@ -337,15 +333,13 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
return self->checkTxInfoEntriesFormat(txInfoEntries);
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId != 0)
return true;
return _check(cx, this);
}
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<ClientTransactionProfileCorrectnessWorkload> ClientTransactionProfileCorrectnessWorkloadFactory("ClientTransactionProfileCorrectness");

View File

@ -33,20 +33,11 @@ struct CommitBugWorkload : TestWorkload
success = true;
}
virtual std::string description()
{
return "CommitBugWorkload";
}
std::string description() const override { return "CommitBugWorkload"; }
virtual Future<Void> setup(Database const& cx)
{
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx)
{
return timeout(bug1(cx, this) && bug2(cx, this), 60, Void());
}
Future<Void> start(Database const& cx) override { return timeout(bug1(cx, this) && bug2(cx, this), 60, Void()); }
ACTOR Future<Void> bug1(Database cx, CommitBugWorkload *self)
{
@ -170,15 +161,9 @@ struct CommitBugWorkload : TestWorkload
return Void();
}
virtual Future<bool> check(Database const& cx)
{
return success;
}
Future<bool> check(Database const& cx) override { return success; }
virtual void getMetrics( vector<PerfMetric>& m )
{
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<CommitBugWorkload> CommitBugWorkloadFactory("CommitBug");

View File

@ -216,22 +216,14 @@ struct ConfigureDatabaseWorkload : TestWorkload {
g_simulator.usableRegions = 1;
}
virtual std::string description() { return "DestroyDatabaseWorkload"; }
std::string description() const override { return "DestroyDatabaseWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return _setup( cx, this );
}
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
virtual Future<Void> start( Database const& cx ) {
return _start( this, cx );
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<Void> start(Database const& cx) override { return _start(this, cx); }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
m.push_back( retries.getMetric() );
}
void getMetrics(vector<PerfMetric>& m) override { m.push_back(retries.getMetric()); }
static inline uint64_t valueToUInt64( const StringRef& v ) {
long long unsigned int x = 0;

View File

@ -46,22 +46,18 @@ struct ConflictRangeWorkload : TestWorkload {
testReadYourWrites = getOption( options, LiteralStringRef("testReadYourWrites"), false );
}
virtual std::string description() { return "ConflictRange"; }
std::string description() const override { return "ConflictRange"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
return _start( cx, this );
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( withConflicts.getMetric() );
m.push_back( withoutConflicts.getMetric() );
m.push_back( retries.getMetric() );

View File

@ -105,15 +105,9 @@ struct ConsistencyCheckWorkload : TestWorkload
bytesReadInPreviousRound = 0;
}
virtual std::string description()
{
return "ConsistencyCheck";
}
std::string description() const override { return "ConsistencyCheck"; }
virtual Future<Void> setup(Database const& cx)
{
return _setup(cx, this);
}
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
ACTOR Future<Void> _setup(Database cx, ConsistencyCheckWorkload *self)
{
@ -139,21 +133,14 @@ struct ConsistencyCheckWorkload : TestWorkload
return Void();
}
virtual Future<Void> start(Database const& cx)
{
Future<Void> start(Database const& cx) override {
TraceEvent("ConsistencyCheck");
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx)
{
return success;
}
Future<bool> check(Database const& cx) override { return success; }
virtual void getMetrics( vector<PerfMetric>& m )
{
}
void getMetrics(vector<PerfMetric>& m) override {}
void testFailure(std::string message, bool isError = false)
{

View File

@ -51,15 +51,9 @@ struct CpuProfilerWorkload : TestWorkload
success = true;
}
virtual std::string description()
{
return "CpuProfiler";
}
std::string description() const override { return "CpuProfiler"; }
virtual Future<Void> setup(Database const& cx)
{
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
//Turns the profiler on or off
ACTOR Future<Void> updateProfiler(bool enabled, Database cx, CpuProfilerWorkload *self)
@ -110,10 +104,7 @@ struct CpuProfilerWorkload : TestWorkload
return Void();
}
virtual Future<Void> start(Database const& cx)
{
return _start(cx, this);
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start(Database cx, CpuProfilerWorkload *self)
{
@ -134,10 +125,7 @@ struct CpuProfilerWorkload : TestWorkload
return Void();
}
virtual Future<bool> check(Database const& cx)
{
return _check(cx, this);
}
Future<bool> check(Database const& cx) override { return _check(cx, this); }
ACTOR Future<bool> _check(Database cx, CpuProfilerWorkload *self)
{
@ -152,10 +140,7 @@ struct CpuProfilerWorkload : TestWorkload
return self->success;
}
virtual void getMetrics( vector<PerfMetric>& m )
{
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<CpuProfilerWorkload> CpuProfilerWorkloadFactory("CpuProfiler");

View File

@ -53,18 +53,16 @@ struct CycleWorkload : TestWorkload {
minExpectedTransactionsPerSecond = transactionsPerSecond * getOption(options, "expectedRate"_sr, 0.7);
}
virtual std::string description() { return "CycleWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return bulkSetup( cx, this, nodeCount, Promise<double>() );
}
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "CycleWorkload"; }
Future<Void> setup(Database const& cx) override { return bulkSetup(cx, this, nodeCount, Promise<double>()); }
Future<Void> start(Database const& cx) override {
for(int c=0; c<actorCount; c++)
clients.push_back(
timeout(
cycleClient( cx->clone(), this, actorCount / transactionsPerSecond ), testDuration, Void()) );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
int errors = 0;
for(int c=0; c<clients.size(); c++)
errors += clients[c].isError();
@ -73,7 +71,7 @@ struct CycleWorkload : TestWorkload {
clients.clear();
return cycleCheck( cx->clone(), this, !errors );
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
m.push_back( tooOldRetries.getMetric() );

View File

@ -53,15 +53,11 @@ struct DDBalanceWorkload : TestWorkload {
currentbin = deterministicRandom()->randomInt(0,binCount);
}
virtual std::string description() { return "DDBalance"; }
std::string description() const override { return "DDBalance"; }
virtual Future<Void> setup( Database const& cx ) {
return ddbalanceSetup( cx, this );
}
Future<Void> setup(Database const& cx) override { return ddbalanceSetup(cx, this); }
virtual Future<Void> start( Database const& cx ) {
return _start( cx, this );
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start( Database cx, DDBalanceWorkload *self ) {
for(int c=0; c<self->moversPerClient; c++)
@ -72,7 +68,7 @@ struct DDBalanceWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
bool ok = true;
for( int i = 0; i < clients.size(); i++ )
if( clients[i].isError() )
@ -81,7 +77,7 @@ struct DDBalanceWorkload : TestWorkload {
return ok;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
double duration = testDuration * (discardEdgeMeasurements ? 0.75 : 1.0);
m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) );
m.push_back( operations.getMetric() );

View File

@ -35,7 +35,7 @@ struct DDMetricsWorkload : TestWorkload {
startDelay = getOption( options, LiteralStringRef("beginPoll"), 10.0 );
}
virtual std::string description() { return "Data Distribution Metrics"; }
std::string description() const override { return "Data Distribution Metrics"; }
ACTOR Future<int> getHighPriorityRelocationsInFlight( Database cx, DDMetricsWorkload *self ) {
WorkerInterface masterWorker = wait(getMasterWorker(cx, self->dbInfo));
@ -69,18 +69,11 @@ struct DDMetricsWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
return clientId == 0 ? work( cx, this ) : Void();
}
Future<Void> start(Database const& cx) override { return clientId == 0 ? work(cx, this) : Void(); }
virtual Future<bool> check( Database const& cx ) {
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
m.push_back( PerfMetric( "DDDuration", ddDone, false ) );
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override { m.push_back(PerfMetric("DDDuration", ddDone, false)); }
};
WorkloadFactory<DDMetricsWorkload> DDMetricsWorkloadFactory("DDMetrics");

View File

@ -90,22 +90,21 @@ struct DDMetricsExcludeWorkload : TestWorkload {
return Void();
}
virtual std::string description() { return "Data Distribution Metrics Exclude"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) { return _start(cx, this); }
virtual Future<bool> check( Database const& cx ) {
std::string description() const override { return "Data Distribution Metrics Exclude"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
Future<bool> check(Database const& cx) override {
movingDataPerSec = peakMovingData / ddDone;
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( PerfMetric( "peakMovingData", peakMovingData, false));
m.push_back( PerfMetric( "peakInQueue", peakInQueue, false));
m.push_back( PerfMetric( "peakInFlight", peakInFlight, false));
m.push_back( PerfMetric( "DDDuration", ddDone, false ) );
m.push_back( PerfMetric( "movingDataPerSec", movingDataPerSec, false));
}
};
WorkloadFactory<DDMetricsExcludeWorkload> DDMetricsExcludeWorkloadFactory("DDMetricsExclude");

View File

@ -184,12 +184,12 @@ struct DataDistributionMetricsWorkload : KVWorkload {
return Void();
}
virtual std::string description() { return "DataDistributionMetrics"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
virtual Future<Void> start(Database const& cx) { return _start(cx, this); }
virtual Future<bool> check(Database const& cx) { return _check(cx, this); }
std::string description() const override { return "DataDistributionMetrics"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
Future<bool> check(Database const& cx) override { return _check(cx, this); }
virtual void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back(PerfMetric("NumShards", numShards, true));
m.push_back(PerfMetric("AvgBytes", avgBytes, true));
m.push_back(commits.getMetric());

View File

@ -45,7 +45,7 @@ struct DifferentClustersSameRVWorkload : TestWorkload {
keyToWatch = getOption(options, LiteralStringRef("keyToWatch"), LiteralStringRef("anotherKey"));
}
std::string description() override { return "DifferentClustersSameRV"; }
std::string description() const override { return "DifferentClustersSameRV"; }
Future<Void> setup(Database const& cx) override { return Void(); }

View File

@ -96,13 +96,9 @@ struct DiskDurabilityWorkload : public AsyncFileWorkload
virtual ~DiskDurabilityWorkload(){ }
virtual std::string description()
{
return "DiskDurability";
}
std::string description() const override { return "DiskDurability"; }
virtual Future<Void> setup(Database const& cx)
{
Future<Void> setup(Database const& cx) override {
if(enabled)
return _setup(this);
@ -137,8 +133,7 @@ struct DiskDurabilityWorkload : public AsyncFileWorkload
return Void();
}
virtual Future<Void> start(Database const& cx)
{
Future<Void> start(Database const& cx) override {
if(enabled)
return _start(this);
@ -185,9 +180,7 @@ struct DiskDurabilityWorkload : public AsyncFileWorkload
return Void();
}
virtual void getMetrics(vector<PerfMetric>& m)
{
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<DiskDurabilityWorkload> DiskDurabilityWorkloadFactory("DiskDurability");

View File

@ -39,36 +39,34 @@ struct DiskDurabilityTest : TestWorkload {
metrics = prefixRange( prefix );
}
virtual std::string description() { return "DiskDurabilityTest"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "DiskDurabilityTest"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled)
return durabilityTest(this, cx);
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
Value encodeValue( int64_t x ) {
static Value encodeValue(int64_t x) {
x = bigEndian64(x);
return StringRef( (const uint8_t*)&x, sizeof(x) );
}
Key encodeKey( int64_t x ) {
return encodeValue(x).withPrefix(range.begin);
}
Key encodeKey(int64_t x) const { return encodeValue(x).withPrefix(range.begin); }
int64_t decodeValue( ValueRef k ) {
static int64_t decodeValue(ValueRef k) {
ASSERT( k.size() == sizeof(int64_t) );
return bigEndian64( *(int64_t*)k.begin() );
}
int64_t decodeKey( KeyRef k ) { return decodeValue(k.removePrefix(range.begin)); }
int64_t decodeKey(KeyRef k) const { return decodeValue(k.removePrefix(range.begin)); }
void encodePage( uint8_t* page, int64_t value ) {
static void encodePage(uint8_t* page, int64_t value) {
int64_t *ipage = (int64_t*)page;
for(int i=0; i<4096/8; i++)
ipage[i] = value + i;
}
int64_t decodePage( uint8_t* page ) {
static int64_t decodePage(uint8_t* page) {
int64_t *ipage = (int64_t*)page;
for(int i=0; i<4096/8; i++)
if (ipage[i] != ipage[0] + i)

View File

@ -150,7 +150,7 @@ struct DowngradeWorkload : TestWorkload {
return Void();
}
std::string description() override { return NAME; }
std::string description() const override { return NAME; }
Future<Void> setup(Database const& cx) override {
return clientId ? Void() : (writeOld(cx, numObjects, oldKey) && writeNew(cx, numObjects, newKey));

View File

@ -32,11 +32,9 @@ struct DummyWorkload : TestWorkload {
displayDelay = getOption(options, LiteralStringRef("displayDelay"), 0.0);
}
virtual std::string description() {
return "DummyWorkload";
}
std::string description() const override { return "DummyWorkload"; }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if ((clientId == 0) && (displayWorkers)) {
return _start(this, cx);
}
@ -50,12 +48,9 @@ struct DummyWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<DummyWorkload> DummyWorkloadFactory("DummyWorkload");

View File

@ -166,7 +166,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext {
}
}
std::string description() override { return NAME; }
std::string description() const override { return NAME; }
ACTOR Future<Void> assertTrue(StringRef stage, Future<bool> f) {
bool res = wait(f);
@ -230,7 +230,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext {
}
}
double getCheckTimeout() override {
double getCheckTimeout() const override {
if (!success) {
return 3000;
}

View File

@ -42,9 +42,9 @@ struct FastTriggeredWatchesWorkload : TestWorkload {
keyBytes = std::max( getOption( options, LiteralStringRef("keyBytes"), 16 ), 16 );
}
virtual std::string description() { return "Watches"; }
std::string description() const override { return "Watches"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
if( clientId == 0 )
return _setup( cx, this );
return Void();
@ -67,7 +67,7 @@ struct FastTriggeredWatchesWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 )
return _start( cx, this );
return Void();
@ -146,7 +146,7 @@ struct FastTriggeredWatchesWorkload : TestWorkload {
}
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
bool ok = true;
for( int i = 0; i < clients.size(); i++ )
if( clients[i].isError() )
@ -155,14 +155,14 @@ struct FastTriggeredWatchesWorkload : TestWorkload {
return ok;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
double duration = testDuration;
m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) );
m.push_back( operations.getMetric() );
m.push_back( retries.getMetric() );
}
Key keyForIndex( uint64_t index ) {
Key keyForIndex(uint64_t index) const {
Key result = makeString( keyBytes );
uint8_t* data = mutateString( result );
memset(data, '.', keyBytes);

View File

@ -63,22 +63,18 @@ struct FileSystemWorkload : TestWorkload {
loggingQueries = getOption( options, LiteralStringRef("loggingQueries"), false );
}
virtual std::string description() { return "ReadWrite"; }
std::string description() const override { return "ReadWrite"; }
virtual Future<Void> setup( Database const& cx ) {
return nodeSetup( cx, this );
}
Future<Void> setup(Database const& cx) override { return nodeSetup(cx, this); }
virtual Future<Void> start( Database const& cx ) {
return _start( cx, this );
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
double duration = testDuration * (discardEdgeMeasurements ? 0.75 : 1.0);
m.push_back( PerfMetric( "Measured Duration", duration, true ) );
m.push_back( PerfMetric( "Transactions/sec", queries.getValue() / duration, false ) );

View File

@ -32,9 +32,9 @@ struct ActorFuzzWorkload : TestWorkload {
enabled = !clientId; // only do this on the "first" client
}
virtual std::string description() { return "ActorFuzzWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "ActorFuzzWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled) {
// Only include this test outside of Windows because of MSVC compiler bug
fuzzResults.second = 0;
@ -49,8 +49,8 @@ struct ActorFuzzWorkload : TestWorkload {
}
return Void();
}
virtual Future<bool> check( Database const& cx ) { return fuzzResults.first == fuzzResults.second; }
virtual void getMetrics( vector<PerfMetric>& m ) {}
Future<bool> check(Database const& cx) override { return fuzzResults.first == fuzzResults.second; }
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<ActorFuzzWorkload> ActorFuzzWorkloadFactory("ActorFuzz");

View File

@ -173,24 +173,20 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
TraceEvent("RemapEventSeverity").detail("TargetEvent", "LargeTransaction").detail("OriginalSeverity", SevWarnAlways).detail("NewSeverity", SevInfo);
}
virtual std::string description() { return "FuzzApiCorrectness"; }
std::string description() const override { return "FuzzApiCorrectness"; }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 ) {
return loadAndRun( cx, this );
}
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return success;
}
Future<bool> check(Database const& cx) override { return success; }
Key getRandomKey() {
return getKeyForIndex( deterministicRandom()->randomInt(0, nodes ) );
}
Key getRandomKey() const { return getKeyForIndex(deterministicRandom()->randomInt(0, nodes)); }
Key getKeyForIndex( int idx ) {
Key getKeyForIndex(int idx) const {
idx += minNode;
if( adjacentKeys ) {
return Key( keyPrefix + std::string( idx, '\x00' ) );
@ -199,11 +195,11 @@ struct FuzzApiCorrectnessWorkload : TestWorkload {
}
}
Value getRandomValue() {
Value getRandomValue() const {
return Value( std::string( deterministicRandom()->randomInt(valueSizeRange.first,valueSizeRange.second+1), 'x' ) );
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
//m.push_back( transactions.getMetric() );
//m.push_back( retries.getMetric() );
}

View File

@ -53,7 +53,7 @@ struct HealthMetricsApiWorkload : TestWorkload {
maxAllowedStaleness = getOption(options, LiteralStringRef("maxAllowedStaleness"), 60.0);
}
virtual std::string description() { return HealthMetricsApiWorkload::NAME; }
std::string description() const override { return HealthMetricsApiWorkload::NAME; }
ACTOR static Future<Void> _setup(Database cx, HealthMetricsApiWorkload* self) {
if (!self->sendDetailedHealthMetrics) {
@ -64,14 +64,14 @@ struct HealthMetricsApiWorkload : TestWorkload {
}
return Void();
}
virtual Future<Void> setup(Database const& cx) { return _setup(cx, this); }
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
ACTOR static Future<Void> _start(Database cx, HealthMetricsApiWorkload* self) {
wait(timeout(healthMetricsChecker(cx, self), self->testDuration, Void()));
return Void();
}
virtual Future<Void> start(Database const& cx) { return _start(cx, this); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (healthMetricsStoppedUpdating) {
TraceEvent(SevError, "HealthMetricsStoppedUpdating");
return false;
@ -103,7 +103,7 @@ struct HealthMetricsApiWorkload : TestWorkload {
return correctHealthMetricsState;
}
virtual void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back(PerfMetric("WorstStorageQueue", worstStorageQueue, true));
m.push_back(PerfMetric("DetailedWorstStorageQueue", detailedWorstStorageQueue, true));
m.push_back(PerfMetric("WorstStorageDurabilityLag", worstStorageDurabilityLag, true));

View File

@ -44,19 +44,17 @@ struct Increment : TestWorkload {
minExpectedTransactionsPerSecond = transactionsPerSecond * getOption( options, LiteralStringRef("expectedRate"), 0.7 );
}
virtual std::string description() { return "IncrementWorkload"; }
std::string description() const override { return "IncrementWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
for(int c=0; c<actorCount; c++)
clients.push_back(
timeout(
incrementClient( cx->clone(), this, actorCount / transactionsPerSecond ), testDuration, Void()) );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
int errors = 0;
for(int c=0; c<clients.size(); c++)
errors += clients[c].isError();
@ -65,7 +63,7 @@ struct Increment : TestWorkload {
clients.clear();
return incrementCheck( cx->clone(), this, !errors );
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
m.push_back( tooOldRetries.getMetric() );

View File

@ -49,18 +49,18 @@ struct IncrementalBackupWorkload : TestWorkload {
checkBeginVersion = getOption(options, LiteralStringRef("checkBeginVersion"), false);
}
virtual std::string description() { return "IncrementalBackup"; }
std::string description() const override { return "IncrementalBackup"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId) {
return Void();
}
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId) {
return true;
}
@ -175,7 +175,7 @@ struct IncrementalBackupWorkload : TestWorkload {
return Void();
}
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<IncrementalBackupWorkload> IncrementalBackupWorkloadFactory("IncrementalBackup");

View File

@ -43,23 +43,23 @@ struct IndexScanWorkload : KVWorkload {
readYourWrites = getOption( options, LiteralStringRef("readYourWrites"), true );
}
virtual std::string description() { return "SimpleRead"; }
std::string description() const override { return "SimpleRead"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
// this will be set up by and external force!
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( singleProcess && clientId != 0 ) {
return Void();
}
return _start( cx, this );
}
virtual Future<bool> check(const Database&) { return true; }
Future<bool> check(const Database&) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
if( singleProcess && clientId != 0 )
return;

View File

@ -47,9 +47,9 @@ struct InventoryTestWorkload : TestWorkload {
productsPerWrite = getOption( options, LiteralStringRef("productsPerWrite"), 2 );
}
virtual std::string description() { return "InventoryTest"; }
std::string description() const override { return "InventoryTest"; }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if (clientId) return Void();
for(int c=0; c<actorCount; c++)
clients.push_back(
@ -61,7 +61,7 @@ struct InventoryTestWorkload : TestWorkload {
return waitForAll(clients);
}
int failures() {
int failures() const {
int failures = 0;
for(int c=0; c<clients.size(); c++)
if (clients[c].isReady() && clients[c].isError()) {
@ -70,12 +70,12 @@ struct InventoryTestWorkload : TestWorkload {
return failures;
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
if (clientId) return true;
return inventoryTestCheck(cx->clone(), this);
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( PerfMetric("Client Failures", failures(), false) );
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
@ -87,7 +87,7 @@ struct InventoryTestWorkload : TestWorkload {
transactions.getValue() * 2 * fractionWriteTransactions / testDuration, true ) );
}
Key chooseProduct() {
Key chooseProduct() const {
int p = deterministicRandom()->randomInt(0,nProducts);
return doubleToTestKey( (double)p / nProducts );
//std::string s = std::string(1,'a' + (p%26)) + format("%d",p/26);

View File

@ -215,21 +215,21 @@ struct KVStoreTestWorkload : TestWorkload {
saturation = getOption(options, LiteralStringRef("saturation"), false);
storeType = getOption(options, LiteralStringRef("storeType"), LiteralStringRef("ssd")).toString();
}
virtual std::string description() { return "KVStoreTest"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
virtual Future<Void> start(Database const& cx) {
std::string description() const override { return "KVStoreTest"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled) return testKVStore(this);
return Void();
}
virtual Future<bool> check(Database const& cx) { return true; }
void metricsFromHistogram(vector<PerfMetric>& m, std::string name, Histogram<float>& h) {
Future<bool> check(Database const& cx) override { return true; }
void metricsFromHistogram(vector<PerfMetric>& m, std::string name, Histogram<float>& h) const {
m.push_back(PerfMetric("Min " + name, 1000.0 * h.min(), true));
m.push_back(PerfMetric("Average " + name, 1000.0 * h.mean(), true));
m.push_back(PerfMetric("Median " + name, 1000.0 * h.medianEstimate(), true));
m.push_back(PerfMetric("95%% " + name, 1000.0 * h.percentileEstimate(0.95), true));
m.push_back(PerfMetric("Max " + name, 1000.0 * h.max(), true));
}
virtual void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
if (setupTook) m.push_back(PerfMetric("SetupTook", setupTook, false));
m.push_back(reads.getMetric());

View File

@ -40,22 +40,21 @@ struct KillRegionWorkload : TestWorkload {
g_simulator.usableRegions = 1;
}
virtual std::string description() { return "KillRegionWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
std::string description() const override { return "KillRegionWorkload"; }
Future<Void> setup(Database const& cx) override {
if(enabled) {
return _setup( this, cx );
}
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if(enabled) {
return killRegion( this, cx );
}
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> _setup( KillRegionWorkload *self, Database cx ) {
TraceEvent("ForceRecovery_DisablePrimaryBegin");

View File

@ -54,7 +54,7 @@ struct LocalRatekeeperWorkload : TestWorkload {
blockWritesFor = getOption(options, LiteralStringRef("blockWritesFor"),
double(SERVER_KNOBS->STORAGE_DURABILITY_LAG_HARD_MAX)/double(1e6));
}
virtual std::string description() { return "LocalRatekeeperWorkload"; }
std::string description() const { return "LocalRatekeeperWorkload"; }
ACTOR static Future<Void> testStorage(LocalRatekeeperWorkload* self, Database cx, StorageServerInterface ssi) {
state Transaction tr(cx);
@ -123,15 +123,15 @@ struct LocalRatekeeperWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
// we run this only on one client
if (clientId != 0 || !g_network->isSimulated()) {
return Void();
}
return _start(this, cx);
}
virtual Future<bool> check(Database const& cx) { return !testFailed; }
virtual void getMetrics(vector<PerfMetric>& m) {}
Future<bool> check(Database const& cx) override { return !testFailed; }
void getMetrics(vector<PerfMetric>& m) override {}
};
} // namespace

View File

@ -38,23 +38,18 @@ struct LockDatabaseWorkload : TestWorkload {
ASSERT(unlockAfter > lockAfter);
}
virtual std::string description() { return "LockDatabase"; }
std::string description() const override { return "LockDatabase"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId == 0) return onlyCheckLocked ? timeout(checkLocked(cx, this), 60, Void()) : lockWorker(cx, this);
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return ok;
}
Future<bool> check(Database const& cx) override { return ok; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Standalone<RangeResultRef>> lockAndSave( Database cx, LockDatabaseWorkload* self, UID lockID ) {
state Transaction tr(cx);

View File

@ -34,7 +34,7 @@ struct LockDatabaseFrequentlyWorkload : TestWorkload {
testDuration = getOption(options, LiteralStringRef("testDuration"), 60);
}
std::string description() override { return "LockDatabaseFrequently"; }
std::string description() const override { return "LockDatabaseFrequently"; }
Future<Void> setup(Database const& cx) override { return Void(); }

View File

@ -43,9 +43,9 @@ struct LogMetricsWorkload : TestWorkload {
dataFolder = getOption( options, LiteralStringRef("dataFolder"), LiteralStringRef("") ).toString();
}
virtual std::string description() { return "LogMetricsWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "LogMetricsWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if(clientId)
return Void();
return _start( cx, this );
@ -92,9 +92,8 @@ struct LogMetricsWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<LogMetricsWorkload> LogMetricsWorkloadFactory("LogMetrics");

View File

@ -47,13 +47,11 @@ struct LowLatencyWorkload : TestWorkload {
testKey = getOption(options, LiteralStringRef("testKey"), LiteralStringRef("testKey"));
}
virtual std::string description() { return "LowLatency"; }
std::string description() const override { return "LowLatency"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 )
return _start( cx, this );
return Void();
@ -102,11 +100,9 @@ struct LowLatencyWorkload : TestWorkload {
}
}
virtual Future<bool> check( Database const& cx ) {
return ok;
}
Future<bool> check(Database const& cx) override { return ok; }
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
double duration = testDuration;
m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) );
m.push_back( operations.getMetric() );

View File

@ -112,11 +112,9 @@ struct MachineAttritionWorkload : TestWorkload {
return machines;
}
virtual std::string description() { return "MachineAttritionWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "MachineAttritionWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled) {
std::map<Optional<Standalone<StringRef>>,LocalityData> machineIDMap;
auto processes = getServers();
@ -149,9 +147,8 @@ struct MachineAttritionWorkload : TestWorkload {
throw please_reboot();
return Void();
}
virtual Future<bool> check( Database const& cx ) { return ignoreSSFailures; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return ignoreSSFailures; }
void getMetrics(vector<PerfMetric>& m) override {}
static bool noSimIsViableKill(WorkerDetails worker) {
return (worker.processClass != ProcessClass::ClassType::TesterClass);

View File

@ -146,7 +146,7 @@ struct MakoWorkload : TestWorkload {
}
}
std::string description() override {
std::string description() const override {
// Mako is a simple workload to measure the performance of FDB.
// The primary purpose of this benchmark is to generate consistent performance results
return "Mako";
@ -171,7 +171,7 @@ struct MakoWorkload : TestWorkload {
}
// disable the default timeout setting
double getCheckTimeout() override { return std::numeric_limits<double>::max(); }
double getCheckTimeout() const override { return std::numeric_limits<double>::max(); }
void getMetrics(std::vector<PerfMetric>& m) override {
// metrics of population process

View File

@ -40,11 +40,14 @@ struct MemoryLifetime : KVWorkload {
valueString = std::string( maxValueBytes, '.' );
}
virtual std::string description() { return "MemoryLifetime"; }
std::string description() const override { return "MemoryLifetime"; }
Value randomValue() { return StringRef( (uint8_t*)valueString.c_str(), deterministicRandom()->randomInt(minValueBytes, maxValueBytes+1) ); }
Value randomValue() const {
return StringRef((uint8_t*)valueString.c_str(),
deterministicRandom()->randomInt(minValueBytes, maxValueBytes + 1));
}
KeySelector getRandomKeySelector() {
KeySelector getRandomKeySelector() const {
return KeySelectorRef( getRandomKey(), deterministicRandom()->random01() < 0.5, deterministicRandom()->randomInt(-nodeCount, nodeCount) );
}
@ -52,21 +55,13 @@ struct MemoryLifetime : KVWorkload {
return KeyValueRef( keyForIndex( n, false ), randomValue() );
}
virtual Future<Void> setup( Database const& cx ) {
return _setup(cx, this);
}
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
virtual Future<Void> start( Database const& cx ) {
return _start(cx, this);
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check( Database const& cx ) {
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> _setup( Database cx, MemoryLifetime* self) {
state Promise<double> loadTime;

View File

@ -54,11 +54,9 @@ struct MetricLoggingWorkload : TestWorkload {
}
}
virtual std::string description() { return "MetricLogging"; }
std::string description() const override { return "MetricLogging"; }
virtual Future<Void> setup( Database const& cx ) {
return _setup( this, cx );
}
Future<Void> setup(Database const& cx) override { return _setup(this, cx); }
ACTOR Future<Void> _setup( MetricLoggingWorkload* self, Database cx ) {
wait( delay(2.0) );
@ -72,18 +70,18 @@ struct MetricLoggingWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
for(int c = 0; c < actorCount; c++)
clients.push_back( timeout( MetricLoggingClient( cx, this, clientId, c ), testDuration, Void() ) );
return waitForAll( clients );
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( changes.getMetric() );
m.push_back( PerfMetric( "Changes/sec", changes.getValue() / testDuration, false ) );
}

View File

@ -33,11 +33,11 @@ struct RunRestoreWorkerWorkload : TestWorkload {
TraceEvent("RunRestoreWorkerWorkloadMX");
}
virtual std::string description() { return "RunRestoreWorkerWorkload"; }
std::string description() const override { return "RunRestoreWorkerWorkload"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
int num_myWorkers = SERVER_KNOBS->FASTRESTORE_NUM_APPLIERS + SERVER_KNOBS->FASTRESTORE_NUM_LOADERS + 1;
TraceEvent("RunParallelRestoreWorkerWorkload").detail("Start", "RestoreToolDB").detail("Workers", num_myWorkers);
printf("RunParallelRestoreWorkerWorkload, we will start %d restore workers\n", num_myWorkers);
@ -51,9 +51,9 @@ struct RunRestoreWorkerWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check(Database const& cx) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<RunRestoreWorkerWorkload> RunRestoreWorkerWorkloadFactory("RunRestoreWorkerWorkload");

View File

@ -48,24 +48,22 @@ struct PerformanceWorkload : TestWorkload {
printf( "saved %d options\n", savedOptions.size() );
}
virtual std::string description() { return "PerformanceTestWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
std::string description() const override { return "PerformanceTestWorkload"; }
Future<Void> setup(Database const& cx) override {
if( !clientId )
return _setup( cx, this );
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( !clientId )
return _start( cx, this );
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
for(int i=0; i < metrics.size(); i++)
m.push_back( metrics[i] );
if( !clientId ) {

View File

@ -70,13 +70,13 @@ struct PingWorkload : TestWorkload {
actorCount = getOption( options, LiteralStringRef("actorCount"), 1 );
}
virtual std::string description() { return "PingWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
std::string description() const override { return "PingWorkload"; }
Future<Void> setup(Database const& cx) override {
if (pingWorkers || !registerInterface)
return Void();
return persistInterface( this, cx );
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
vector<Future<Void>> clients;
if (pingWorkers) {
clients.push_back( workerPinger( this ) );
@ -92,9 +92,9 @@ struct PingWorkload : TestWorkload {
return timeout( waitForAll(clients), testDuration, Void() );//delay( testDuration );
}
virtual Future<bool> check( Database const& cx ) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( messages.getMetric() );
m.push_back( PerfMetric( "Avg Latency (ms)", 1000 * totalMessageLatency.getValue() / messages.getValue(), true ) );
m.push_back( maxMessageLatency.getMetric() );

View File

@ -153,7 +153,7 @@ struct PopulateTPCC : TestWorkload {
}
}
virtual std::string description() override { return DESCRIPTION; }
std::string description() const override { return DESCRIPTION; }
ACTOR static Future<Void> populateItems(PopulateTPCC* self, Database cx) {
state Transaction tr(cx);
@ -507,11 +507,11 @@ struct PopulateTPCC : TestWorkload {
return populate(this, cx);
}
virtual Future<Void> start(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override { return Void(); }
virtual Future<bool> check(Database const& cx) override { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) override {}
void getMetrics(vector<PerfMetric>& m) override {}
};
} // namespace

View File

@ -41,21 +41,15 @@ struct PubSubMultiplesWorkload : TestWorkload {
inboxesPerActor = getOption( options, LiteralStringRef("inboxesPerActor"), 20 );
}
virtual std::string description() { return "PubSubMultiplesWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return createNodes( this, cx );
}
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "PubSubMultiplesWorkload"; }
Future<Void> setup(Database const& cx) override { return createNodes(this, cx); }
Future<Void> start(Database const& cx) override {
Future<Void> _ = startTests( this, cx );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
m.push_back( messages.getMetric() );
}
void getMetrics(vector<PerfMetric>& m) override { m.push_back(messages.getMetric()); }
Key keyForFeed( int i ) { return StringRef( format( "/PSM/feeds/%d", i ) ); }
Key keyForInbox( int i ) { return StringRef( format( "/PSM/inbox/%d", i ) ); }

View File

@ -54,12 +54,12 @@ struct QueuePushWorkload : TestWorkload {
startingKey = LiteralStringRef("0000000000000001");
}
virtual std::string description() { return "QueuePush"; }
virtual Future<Void> start( Database const& cx ) { return _start( cx, this ); }
std::string description() const override { return "QueuePush"; }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check( Database const& cx ) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(std::vector<PerfMetric>& m ) {
void getMetrics(std::vector<PerfMetric>& m) override {
double duration = testDuration;
int writes = transactions.getValue();
m.emplace_back("Measured Duration", duration, true);

View File

@ -38,13 +38,11 @@ struct RYWDisableWorkload : TestWorkload {
keyBytes = std::max( getOption( options, LiteralStringRef("keyBytes"), 16 ), 16 );
}
virtual std::string description() { return "RYWDisable"; }
std::string description() const { return "RYWDisable"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 )
return _start( cx, this );
return Void();
@ -102,7 +100,7 @@ struct RYWDisableWorkload : TestWorkload {
}
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
bool ok = true;
for( int i = 0; i < clients.size(); i++ )
if( clients[i].isError() )
@ -111,8 +109,7 @@ struct RYWDisableWorkload : TestWorkload {
return ok;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
Key keyForIndex( uint64_t index ) {
Key result = makeString( keyBytes );

View File

@ -35,9 +35,9 @@ struct RYWPerformanceWorkload : TestWorkload {
keyBytes = std::max( getOption( options, LiteralStringRef("keyBytes"), 16 ), 16 );
}
virtual std::string description() { return "RYWPerformance"; }
std::string description() const override { return "RYWPerformance"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
if( clientId == 0 )
return _setup( cx, this );
return Void();
@ -60,7 +60,7 @@ struct RYWPerformanceWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 )
return _start( cx, this );
return Void();
@ -288,12 +288,9 @@ struct RYWPerformanceWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
Key keyForIndex( uint64_t index ) {
Key result = makeString( keyBytes );

View File

@ -40,9 +40,14 @@ struct RandomCloggingWorkload : TestWorkload {
swizzleClog = getOption( options, LiteralStringRef("swizzle"), 0 );
}
virtual std::string description() { if (&g_simulator == g_network) return "RandomClogging"; else return "NoRC"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override {
if (&g_simulator == g_network)
return "RandomClogging";
else
return "NoRC";
}
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (&g_simulator == g_network && enabled)
return timeout(
reportErrors( swizzleClog ? swizzleClogClient(this) : clogClient(this), "RandomCloggingError" ),
@ -50,11 +55,8 @@ struct RandomCloggingWorkload : TestWorkload {
else
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR void doClog( ISimulator::ProcessInfo* machine, double t, double delay = 0.0 ) {
wait(::delay(delay));

View File

@ -43,11 +43,9 @@ struct MoveKeysWorkload : TestWorkload {
maxKeyspace = getOption( options, LiteralStringRef("maxKeyspace"), 0.1 );
}
virtual std::string description() { return "MoveKeysWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
return _start( cx, this );
}
std::string description() const override { return "MoveKeysWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start( Database cx, MoveKeysWorkload *self ) {
if( self->enabled ) {
@ -76,10 +74,11 @@ struct MoveKeysWorkload : TestWorkload {
return Void();
}
virtual double getCheckTimeout() { return testDuration/2 + 1; }
virtual Future<bool> check( Database const& cx ) { return tag(delay(testDuration/2), true); } // Give the database time to recover from our damage
virtual void getMetrics( vector<PerfMetric>& m ) {
}
double getCheckTimeout() const override { return testDuration / 2 + 1; }
Future<bool> check(Database const& cx) override {
return tag(delay(testDuration / 2), true);
} // Give the database time to recover from our damage
void getMetrics(vector<PerfMetric>& m) override {}
KeyRange getRandomKeys() const {
double len = deterministicRandom()->random01() * this->maxKeyspace;

View File

@ -45,25 +45,23 @@ struct RandomSelectorWorkload : TestWorkload {
fail = false;
}
virtual std::string description() { return "RandomSelector"; }
std::string description() const override { return "RandomSelector"; }
virtual Future<Void> setup( Database const& cx ) {
return randomSelectorSetup( cx->clone(), this );
}
Future<Void> setup(Database const& cx) override { return randomSelectorSetup(cx->clone(), this); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
clients.push_back(
timeout(
randomSelectorClient( cx->clone(), this), testDuration, Void()) );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return !fail;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
}

View File

@ -56,9 +56,9 @@ struct ReadAfterWriteWorkload : KVWorkload {
testDuration = getOption(options, LiteralStringRef("testDuration"), 10.0);
}
virtual std::string description() { return "ReadAfterWriteWorkload"; }
std::string description() const override { return "ReadAfterWriteWorkload"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
ACTOR static Future<Void> benchmark(Database cx, ReadAfterWriteWorkload* self) {
loop {
@ -104,16 +104,16 @@ struct ReadAfterWriteWorkload : KVWorkload {
}
}
virtual Future<Void> start(Database const& cx) { return _start(cx, this); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start(Database cx, ReadAfterWriteWorkload* self) {
state Future<Void> lifetime = benchmark(cx, self);
wait(delay(self->testDuration));
return Void();
}
virtual Future<bool> check(Database const& cx) override { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(std::vector<PerfMetric>& m) {
void getMetrics(std::vector<PerfMetric>& m) override {
m.emplace_back("Mean Latency (ms)", 1000 * propagationLatency.mean(), true);
m.emplace_back("Median Latency (ms, averaged)", 1000 * propagationLatency.median(), true);
m.emplace_back("90% Latency (ms, averaged)", 1000 * propagationLatency.percentile(0.90), true);

View File

@ -44,11 +44,11 @@ struct ReadHotDetectionWorkload : TestWorkload {
readKey = StringRef(format("testkey%08x", deterministicRandom()->randomInt(0, keyCount)));
}
virtual std::string description() { return "ReadHotDetection"; }
std::string description() const override { return "ReadHotDetection"; }
virtual Future<Void> setup(Database const& cx) { return _setup(cx, this); }
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
for (int c = 0; c < actorCount; c++) {
clients.push_back(timeout(keyReader(cx->clone(), this, actorCount / transactionsPerSecond,
deterministicRandom()->random01() > 0.4),
@ -58,7 +58,7 @@ struct ReadHotDetectionWorkload : TestWorkload {
return delay(testDuration);
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId != 0) return true;
return passed;
}
@ -129,7 +129,7 @@ struct ReadHotDetectionWorkload : TestWorkload {
}
}
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> keyReader(Database cx, ReadHotDetectionWorkload* self, double delay, bool useReadKey) {
state double lastTime = now();

View File

@ -219,9 +219,9 @@ struct ReadWriteWorkload : KVWorkload {
}
}
virtual std::string description() { return descriptionString.toString(); }
virtual Future<Void> setup( Database const& cx ) { return _setup( cx, this ); }
virtual Future<Void> start( Database const& cx ) { return _start( cx, this ); }
std::string description() const override { return descriptionString.toString(); }
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR static Future<bool> traceDumpWorkers( Reference<AsyncVar<ServerDBInfo>> db ) {
try {
@ -261,7 +261,7 @@ struct ReadWriteWorkload : KVWorkload {
return true;
}
virtual void getMetrics(std::vector<PerfMetric>& m) {
void getMetrics(std::vector<PerfMetric>& m) override {
double duration = metricsDuration;
int reads = (aTransactions.getValue() * readsPerTransactionA) + (bTransactions.getValue() * readsPerTransactionB);
int writes = (aTransactions.getValue() * writesPerTransactionA) + (bTransactions.getValue() * writesPerTransactionB);

View File

@ -59,8 +59,8 @@ struct RemoveServersSafelyWorkload : TestWorkload {
}
}
virtual std::string description() { return "RemoveServersSafelyWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
std::string description() const override { return "RemoveServersSafelyWorkload"; }
Future<Void> setup(Database const& cx) override {
if( !enabled )
return Void();
@ -128,19 +128,17 @@ struct RemoveServersSafelyWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if (!enabled) return Void();
double delay = deterministicRandom()->random01() * (maxDelay-minDelay) + minDelay;
return workloadMain( this, cx, delay, toKill1, toKill2 );
}
virtual Future<bool> check( Database const& cx ) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& ) {
}
void getMetrics(vector<PerfMetric>&) override {}
virtual std::set<AddressExclusion> getNetworks(std::vector<ISimulator::ProcessInfo*> const& processes)
{
std::set<AddressExclusion> getNetworks(std::vector<ISimulator::ProcessInfo*> const& processes) {
std::set<AddressExclusion> processAddrs;
for (auto& processInfo : processes) {
@ -151,8 +149,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
// Get the list of processes whose ip:port or ip matches netAddrs.
// Note: item in netAddrs may be ip (representing a machine) or ip:port (representing a process)
virtual std::vector<ISimulator::ProcessInfo*> getProcesses(std::set<AddressExclusion> const& netAddrs)
{
std::vector<ISimulator::ProcessInfo*> getProcesses(std::set<AddressExclusion> const& netAddrs) {
std::vector<ISimulator::ProcessInfo*> processes;
std::set<AddressExclusion> processAddrs;
UID functionId = nondeterministicRandom()->randomUniqueID();
@ -202,8 +199,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
return processes;
}
virtual std::vector<ISimulator::ProcessInfo*> excludeAddresses(std::set<AddressExclusion> const& procAddrs)
{
std::vector<ISimulator::ProcessInfo*> excludeAddresses(std::set<AddressExclusion> const& procAddrs) {
// Get the updated list of processes which may have changed due to reboots, deletes, etc
std::vector<ISimulator::ProcessInfo*> procArray = getProcesses(procAddrs);
@ -219,8 +215,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
return procArray;
}
virtual std::vector<ISimulator::ProcessInfo*> includeAddresses(std::set<AddressExclusion> const& procAddrs)
{
std::vector<ISimulator::ProcessInfo*> includeAddresses(std::set<AddressExclusion> const& procAddrs) {
// Get the updated list of processes which may have changed due to reboots, deletes, etc
std::vector<ISimulator::ProcessInfo*> procArray = getProcesses(procAddrs);
@ -240,8 +235,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
// Return processes that are intersection of killAddrs and allServers and that are safe to kill together;
// killAddrs does not guarantee the addresses are safe to kill simultaneously.
virtual std::vector<ISimulator::ProcessInfo*> protectServers(std::set<AddressExclusion> const& killAddrs)
{
std::vector<ISimulator::ProcessInfo*> protectServers(std::set<AddressExclusion> const& killAddrs) {
std::vector<ISimulator::ProcessInfo*> processes;
std::set<AddressExclusion> processAddrs;
std::vector<AddressExclusion> killableAddrs;
@ -380,8 +374,7 @@ struct RemoveServersSafelyWorkload : TestWorkload {
return Void();
}
virtual std::vector<ISimulator::ProcessInfo*> killAddresses(std::set<AddressExclusion> const& killAddrs)
{
std::vector<ISimulator::ProcessInfo*> killAddresses(std::set<AddressExclusion> const& killAddrs) {
UID functionId = nondeterministicRandom()->randomUniqueID();
bool removeViaClear = !BUGGIFY;
std::vector<ISimulator::ProcessInfo*> killProcArray;

View File

@ -59,7 +59,7 @@ struct ReportConflictingKeysWorkload : TestWorkload {
nodeCount = getOption(options, LiteralStringRef("nodeCount"), 100);
}
std::string description() override { return "ReportConflictingKeysWorkload"; }
std::string description() const override { return "ReportConflictingKeysWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
@ -83,7 +83,7 @@ struct ReportConflictingKeysWorkload : TestWorkload {
}
// disable the default timeout setting
double getCheckTimeout() override { return std::numeric_limits<double>::max(); }
double getCheckTimeout() const override { return std::numeric_limits<double>::max(); }
// Copied from tester.actor.cpp, added parameter to determine the key's length
Key keyForIndex(int n) {

View File

@ -46,18 +46,17 @@ struct RollbackWorkload : TestWorkload {
multiple = getOption( options, LiteralStringRef("multiple"), true );
}
virtual std::string description() { return "RollbackWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "RollbackWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (&g_simulator == g_network && enabled)
return timeout(
reportErrors( rollbackFailureWorker( cx, this, meanDelay ), "RollbackFailureWorkerError" ),
testDuration, Void() );
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> simulateFailure( Database cx, RollbackWorkload* self ) {
state ServerDBInfo system = self->dbInfo->get();

View File

@ -74,9 +74,7 @@ struct RyowCorrectnessWorkload : ApiWorkload {
opsPerTransaction = getOption(options, LiteralStringRef("opsPerTransaction"), 50);
}
virtual std::string description() {
return "RyowCorrectness";
}
std::string description() const override { return "RyowCorrectness"; }
ACTOR Future<Void> performSetup(Database cx, RyowCorrectnessWorkload *self) {
std::vector<TransactionType> types;
@ -353,9 +351,7 @@ struct RyowCorrectnessWorkload : ApiWorkload {
return ::success(timeout(performTest(cx, data, this), duration));
}
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<RyowCorrectnessWorkload> RyowCorrectnessWorkloadFactory("RyowCorrectness");

View File

@ -44,14 +44,12 @@ struct SaveAndKillWorkload : TestWorkload {
isRestoring = getOption( options, LiteralStringRef("isRestoring"), 0 );
}
virtual std::string description() { return "SaveAndKillWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
std::string description() const override { return "SaveAndKillWorkload"; }
Future<Void> setup(Database const& cx) override {
g_simulator.disableSwapsToAll();
return Void();
}
virtual Future<Void> start( Database const& cx ) {
return _start(this);
}
Future<Void> start(Database const& cx) override { return _start(this); }
ACTOR Future<Void> _start( SaveAndKillWorkload* self) {
state int i;
@ -131,11 +129,8 @@ struct SaveAndKillWorkload : TestWorkload {
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
virtual void getMetrics( std::vector<PerfMetric>& ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(std::vector<PerfMetric>&) override {}
};
WorkloadFactory<SaveAndKillWorkload> SaveAndKillWorkloadFactory("SaveAndKill");

View File

@ -43,25 +43,23 @@ struct SelectorCorrectnessWorkload : TestWorkload {
testDuration = getOption( options, LiteralStringRef("testDuration"), 10.0 );
}
virtual std::string description() { return "SelectorCorrectness"; }
std::string description() const override { return "SelectorCorrectness"; }
virtual Future<Void> setup( Database const& cx ) {
return SelectorCorrectnessSetup( cx->clone(), this );
}
Future<Void> setup(Database const& cx) override { return SelectorCorrectnessSetup(cx->clone(), this); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
clients.push_back(
timeout(
SelectorCorrectnessClient( cx->clone(), this), testDuration, Void()) );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
}

View File

@ -79,34 +79,27 @@ struct SerializabilityWorkload : TestWorkload {
TraceEvent("SerializabilityConfiguration").detail("Nodes", nodes).detail("AdjacentKeys", adjacentKeys).detail("ValueSizeMin", valueSizeRange.first).detail("ValueSizeMax", valueSizeRange.second).detail("MaxClearSize", maxClearSize);
}
virtual std::string description() { return "Serializability"; }
std::string description() const override { return "Serializability"; }
virtual Future<Void> setup( Database const& cx ) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if( clientId == 0 )
return _start( cx, this );
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return success;
}
Future<bool> check(Database const& cx) override { return success; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
Value getRandomValue() {
Value getRandomValue() const {
return Value( std::string( deterministicRandom()->randomInt(valueSizeRange.first,valueSizeRange.second+1), 'x' ) );
}
Key getRandomKey() {
return getKeyForIndex( deterministicRandom()->randomInt(0, nodes ) );
}
Key getRandomKey() const { return getKeyForIndex(deterministicRandom()->randomInt(0, nodes)); }
Key getKeyForIndex( int idx ) {
Key getKeyForIndex(int idx) const {
if( adjacentKeys ) {
return Key( idx ? keyPrefix + std::string( idx, '\x00' ) : "" );
} else {
@ -114,12 +107,12 @@ struct SerializabilityWorkload : TestWorkload {
}
}
KeySelector getRandomKeySelector() {
KeySelector getRandomKeySelector() const {
int scale = 1 << deterministicRandom()->randomInt(0,14);
return KeySelectorRef( getRandomKey(), deterministicRandom()->random01() < 0.5, deterministicRandom()->randomInt(-scale, scale) );
}
KeyRange getRandomRange(int sizeLimit) {
KeyRange getRandomRange(int sizeLimit) const {
int startLocation = deterministicRandom()->randomInt(0, nodes);
int scale = deterministicRandom()->randomInt(0, deterministicRandom()->randomInt(2, 5) * deterministicRandom()->randomInt(2, 5));
int endLocation = startLocation + deterministicRandom()->randomInt(0, 1+std::min(sizeLimit, std::min(nodes-startLocation, 1<<scale)));

View File

@ -65,16 +65,14 @@ struct SidebandWorkload : TestWorkload {
operationsPerSecond = getOption( options, LiteralStringRef("operationsPerSecond"), 50.0 );
}
virtual std::string description() { return "SidebandWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return persistInterface( this, cx->clone() );
}
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "SidebandWorkload"; }
Future<Void> setup(Database const& cx) override { return persistInterface(this, cx->clone()); }
Future<Void> start(Database const& cx) override {
clients.push_back( mutator( this, cx->clone() ) );
clients.push_back( checker( this, cx->clone() ) );
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
int errors = 0;
for(int c=0; c<clients.size(); c++)
errors += clients[c].isError();
@ -86,7 +84,7 @@ struct SidebandWorkload : TestWorkload {
return !errors && !consistencyErrors.getValue();
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( messages.getMetric() );
m.push_back( consistencyErrors.getMetric() );
m.push_back( keysUnexpectedlyPresent.getMetric() );

View File

@ -43,18 +43,18 @@ struct SimpleAtomicAddWorkload : TestWorkload {
sumKey = getOption(options, LiteralStringRef("sumKey"), LiteralStringRef("sumKey"));
}
virtual std::string description() { return "SimpleAtomicAdd"; }
std::string description() const override { return "SimpleAtomicAdd"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId) {
return Void();
}
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId) {
return true;
}
@ -131,7 +131,7 @@ struct SimpleAtomicAddWorkload : TestWorkload {
}
}
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<SimpleAtomicAddWorkload> SimpleAtomicAddWorkloadFactory("SimpleAtomicAdd");

View File

@ -31,21 +31,16 @@ struct SlowTaskWorkload : TestWorkload {
: TestWorkload(wcx) {
}
virtual std::string description() {
return "SlowTaskWorkload";
}
std::string description() const override { return "SlowTaskWorkload"; }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
setupRunLoopProfiler();
return go();
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> go() {
wait( delay(1) );

View File

@ -102,7 +102,7 @@ public: // ctor & dtor
}
public: // workload functions
std::string description() override { return "SnapTest"; }
std::string description() const override { return "SnapTest"; }
Future<Void> setup(Database const& cx) override {
TraceEvent("SnapTestWorkloadSetup");
return Void();

View File

@ -52,14 +52,14 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload {
ASSERT(conflictRangeSizeFactor >= 1);
}
virtual std::string description() { return "SpecialKeySpaceCorrectness"; }
virtual Future<Void> setup(Database const& cx) { return _setup(cx, this); }
virtual Future<Void> start(Database const& cx) { return _start(cx, this); }
virtual Future<bool> check(Database const& cx) { return wrongResults.getValue() == 0; }
virtual void getMetrics(std::vector<PerfMetric>& m) {}
std::string description() const override { return "SpecialKeySpaceCorrectness"; }
Future<Void> setup(Database const& cx) override { return _setup(cx, this); }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
Future<bool> check(Database const& cx) override { return wrongResults.getValue() == 0; }
void getMetrics(std::vector<PerfMetric>& m) override {}
// disable the default timeout setting
double getCheckTimeout() override { return std::numeric_limits<double>::max(); }
double getCheckTimeout() const override { return std::numeric_limits<double>::max(); }
Future<Void> _setup(Database cx, SpecialKeySpaceCorrectnessWorkload* self) {
cx->specialKeySpace = std::make_unique<SpecialKeySpace>();

View File

@ -57,25 +57,23 @@ struct StatusWorkload : TestWorkload {
noUnseed = true;
}
virtual std::string description() { return "StatusWorkload"; }
virtual Future<Void> setup(Database const& cx) {
std::string description() const override { return "StatusWorkload"; }
Future<Void> setup(Database const& cx) override {
if(enableLatencyBands) {
latencyBandActor = configureLatencyBands(this, cx);
}
return Void();
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0)
return Void();
return success(timeout(fetcher(cx, this), testDuration));
}
virtual Future<bool> check(Database const& cx) {
return errors.getValue() == 0;
}
Future<bool> check(Database const& cx) override { return errors.getValue() == 0; }
virtual void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
if (clientId != 0)
return;

View File

@ -53,13 +53,11 @@ struct StorefrontWorkload : TestWorkload {
minExpectedTransactionsPerSecond = transactionsPerSecond * getOption( options, LiteralStringRef("expectedRate"), 0.9 );
}
virtual std::string description() { return "StorefrontWorkload"; }
std::string description() const override { return "StorefrontWorkload"; }
virtual Future<Void> setup( Database const& cx ) {
return bulkSetup( cx, this, itemCount, Promise<double>() );
}
Future<Void> setup(Database const& cx) override { return bulkSetup(cx, this, itemCount, Promise<double>()); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
for(int c=0; c<actorCount; c++)
clients.push_back(
orderingClient( cx->clone(), this, actorCount / transactionsPerSecond ) );
@ -70,7 +68,7 @@ struct StorefrontWorkload : TestWorkload {
return delay(testDuration);
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
int errors = 0;
for(int c=0; c<clients.size(); c++)
if( clients[c].isError() ) {
@ -81,7 +79,7 @@ struct StorefrontWorkload : TestWorkload {
return inventoryCheck( cx->clone(), this, !errors );
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( retries.getMetric() );
m.push_back( PerfMetric( "Avg Latency (ms)", 1000 * totalLatency.getValue() / transactions.getValue(), true ) );

View File

@ -54,24 +54,24 @@ struct StreamingReadWorkload : TestWorkload {
readSequentially = getOption( options, LiteralStringRef("readSequentially"), false);
}
virtual std::string description() { return "StreamingRead"; }
std::string description() const override { return "StreamingRead"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
return bulkSetup( cx, this, nodeCount, Promise<double>(), true, warmingDelay );
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
for(int c = clientId; c < actorCount; c+=clientCount)
clients.push_back( timeout( streamingReadClient( cx, this, clientId, c ), testDuration, Void() ) );
return waitForAll( clients );
}
virtual Future<bool> check( Database const& cx ) {
Future<bool> check(Database const& cx) override {
clients.clear();
return true;
}
virtual void getMetrics( vector<PerfMetric>& m ) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back( transactions.getMetric() );
m.push_back( readKeys.getMetric() );
m.push_back( PerfMetric( "Bytes read/sec",

View File

@ -19,9 +19,9 @@ struct SuspendProcessesWorkload : TestWorkload {
suspendTimeDuration = getOption(options, LiteralStringRef("suspendTimeDuration"), 0);
}
virtual std::string description() { return "SuspendProcesses"; }
std::string description() const override { return "SuspendProcesses"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
ACTOR Future<Void> _start(Database cx, SuspendProcessesWorkload* self) {
wait(delay(self->waitTimeDuration));
@ -59,14 +59,14 @@ struct SuspendProcessesWorkload : TestWorkload {
}
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0) return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<SuspendProcessesWorkload> SuspendProcessesWorkloadFactory("SuspendProcesses");

View File

@ -158,7 +158,7 @@ struct TPCC : TestWorkload {
}
}
virtual std::string description() override { return DESCRIPTION; }
std::string description() const override { return DESCRIPTION; }
// Transactions
@ -674,16 +674,16 @@ struct TPCC : TestWorkload {
}
}
double transactionsPerMinute() {
double transactionsPerMinute() const {
return metrics.successfulNewOrderTransactions * 60.0 / (testDuration - 2 * warmupTime);
}
bool recordMetrics() {
bool recordMetrics() const {
auto now = g_network->now();
return (now > startTime + warmupTime && now < startTime + testDuration - warmupTime);
}
virtual Future<Void> start(Database const& cx) override {
Future<Void> start(Database const& cx) override {
if (clientId >= clientsUsed) return Void();
return _start(cx, this);
}
@ -705,10 +705,10 @@ struct TPCC : TestWorkload {
return Void();
}
virtual Future<bool> check(Database const& cx) override {
Future<bool> check(Database const& cx) override {
return (transactionsPerMinute() > expectedTransactionsPerMinute);
}
virtual void getMetrics(vector<PerfMetric>& m) override {
void getMetrics(vector<PerfMetric>& m) override {
double multiplier = static_cast<double>(clientCount) / static_cast<double>(clientsUsed);
m.push_back(PerfMetric("Transactions Per Minute", transactionsPerMinute(), false));

View File

@ -36,23 +36,21 @@ struct TagThrottleApiWorkload : TestWorkload {
autoThrottleEnabled = SERVER_KNOBS->AUTO_TAG_THROTTLING_ENABLED;
}
virtual std::string description() { return TagThrottleApiWorkload::NAME; }
std::string description() const override { return TagThrottleApiWorkload::NAME; }
virtual Future<Void> setup(Database const& cx) {
Future<Void> setup(Database const& cx) override {
DatabaseContext::debugUseTags = true;
return Void();
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (this->clientId != 0) return Void();
return timeout(runThrottleApi(this, cx), testDuration, Void());
}
virtual Future<bool> check(Database const& cx) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
static Optional<TagThrottleType> randomTagThrottleType() {
Optional<TagThrottleType> throttleType;

View File

@ -43,17 +43,16 @@ struct TargetedKillWorkload : TestWorkload {
killAllMachineProcesses = getOption( options, LiteralStringRef("killWholeMachine"), false );
}
virtual std::string description() { return "TargetedKillWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "TargetedKillWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
TraceEvent("StartTargetedKill").detail("Enabled", enabled);
if (enabled)
return assassin( cx, this );
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> killEndpoint( NetworkAddress address, Database cx, TargetedKillWorkload* self ) {
if( &g_simulator == g_network ) {

View File

@ -171,20 +171,13 @@ struct TaskBucketCorrectnessWorkload : TestWorkload {
subtaskCount = getOption( options, LiteralStringRef("subtaskCount"), 20 );
}
virtual std::string description() {
return "TaskBucketCorrectness";
}
std::string description() const override { return "TaskBucketCorrectness"; }
virtual Future<Void> start(Database const& cx) {
return _start(cx, this);
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
virtual Future<bool> check(Database const& cx) {
return _check(cx, this);
}
Future<bool> check(Database const& cx) override { return _check(cx, this); }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> addInitTasks(Reference<ReadYourWritesTransaction> tr, Reference<TaskBucket> taskBucket, Reference<FutureBucket> futureBucket, bool chained, int subtaskCount) {
state Key addedInitKey(LiteralStringRef("addedInitTasks"));

View File

@ -139,17 +139,11 @@ struct ThreadSafetyWorkload : TestWorkload {
noUnseed = true;
}
virtual std::string description() {
return "ThreadSafety";
}
std::string description() const override { return "ThreadSafety"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
return _start(cx, this);
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR Future<Void> _start(Database cx, ThreadSafetyWorkload *self) {
state std::vector<ThreadInfo*> threadInfo;
@ -293,13 +287,9 @@ struct ThreadSafetyWorkload : TestWorkload {
}
}
virtual Future<bool> check(Database const& cx) {
return success;
}
Future<bool> check(Database const& cx) override { return success; }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<ThreadSafetyWorkload> ThreadSafetyWorkloadFactory("ThreadSafety");

View File

@ -192,13 +192,11 @@ struct ThrottlingWorkload : KVWorkload {
return Void();
}
virtual std::string description() { return ThrottlingWorkload::NAME; }
virtual Future<Void> start(Database const& cx) { return _start(cx, this); }
virtual Future<bool> check(Database const& cx) {
return correctSpecialKeys;
}
std::string description() const override { return ThrottlingWorkload::NAME; }
Future<Void> start(Database const& cx) override { return _start(cx, this); }
Future<bool> check(Database const& cx) override { return correctSpecialKeys; }
virtual void getMetrics(vector<PerfMetric>& m) {
void getMetrics(vector<PerfMetric>& m) override {
m.push_back(PerfMetric("TransactionsCommitted", transactionsCommitted, false));
}
};

View File

@ -335,13 +335,13 @@ struct ThroughputWorkload : TestWorkload {
//testDuration = getOption( options, LiteralStringRef("testDuration"), measureDelay + measureDuration );
}
virtual std::string description() { return "Throughput"; }
std::string description() const override { return "Throughput"; }
virtual Future<Void> setup( Database const& cx ) {
Future<Void> setup(Database const& cx) override {
return Void(); // No setup for now - use a separate workload to do setup
}
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
startT = now();
PromiseStream<Future<Void>> add;
Future<Void> ac = actorCollection( add.getFuture(), &activeActors );
@ -351,7 +351,7 @@ struct ThroughputWorkload : TestWorkload {
return r;
}
virtual Future<bool> check( Database const& cx ) { return true; }
Future<bool> check(Database const& cx) override { return true; }
ACTOR static Future<Void> throughputActor( Database db, ThroughputWorkload* self, PromiseStream<Future<Void>> add ) {
state double before = now();
@ -388,8 +388,6 @@ struct ThroughputWorkload : TestWorkload {
return Void();
}
virtual void getMetrics( vector<PerfMetric>& m ) {
measurer->getMetrics(m);
}
void getMetrics(vector<PerfMetric>& m) override { measurer->getMetrics(m); }
};
WorkloadFactory<ThroughputWorkload> ThroughputWorkloadFactory("Throughput");

View File

@ -32,16 +32,11 @@ struct TimeKeeperCorrectnessWorkload : TestWorkload {
testDuration = getOption( options, LiteralStringRef("testDuration"), 20.0 );
}
virtual std::string description() {
return "TimeKeeperCorrectness";
}
std::string description() const override { return "TimeKeeperCorrectness"; }
virtual Future<Void> setup(Database const& cx) {
return Void();
}
Future<Void> setup(Database const& cx) override { return Void(); }
virtual void getMetrics(vector<PerfMetric>& m) {
}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR static Future<Void> _start(Database cx, TimeKeeperCorrectnessWorkload *self) {
TraceEvent(SevInfo, "TKCorrectness_Start");
@ -69,9 +64,7 @@ struct TimeKeeperCorrectnessWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start( Database const& cx ) {
return _start(cx, this);
}
Future<Void> start(Database const& cx) override { return _start(cx, this); }
ACTOR static Future<bool> _check(Database cx, TimeKeeperCorrectnessWorkload *self) {
state KeyBackedMap<int64_t, Version> dbTimeKeeper = KeyBackedMap<int64_t, Version>(timeKeeperPrefixRange.begin);
@ -126,9 +119,7 @@ struct TimeKeeperCorrectnessWorkload : TestWorkload {
}
}
virtual Future<bool> check( Database const& cx ) {
return _check(cx, this);
}
Future<bool> check(Database const& cx) override { return _check(cx, this); }
};
WorkloadFactory<TimeKeeperCorrectnessWorkload> TimeKeeperCorrectnessWorkloadFactory("TimeKeeperCorrectness");

View File

@ -26,7 +26,7 @@ struct TriggerRecoveryLoopWorkload : TestWorkload {
.detail("DelayBetweenRecoveries", delayBetweenRecoveries);
}
virtual std::string description() { return "TriggerRecoveryLoop"; }
std::string description() const override { return "TriggerRecoveryLoop"; }
ACTOR Future<Void> setOriginalNumOfResolvers(Database cx, TriggerRecoveryLoopWorkload* self) {
DatabaseConfiguration config = wait(getDatabaseConfiguration(cx));
@ -34,7 +34,7 @@ struct TriggerRecoveryLoopWorkload : TestWorkload {
return Void();
}
virtual Future<Void> setup(Database const& cx) {
Future<Void> setup(Database const& cx) override {
if (clientId == 0) {
return setOriginalNumOfResolvers(cx, this);
}
@ -142,14 +142,14 @@ struct TriggerRecoveryLoopWorkload : TestWorkload {
return Void();
}
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
if (clientId != 0) return Void();
return _start(cx, this);
}
virtual Future<bool> check(Database const& cx) { return true; }
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<TriggerRecoveryLoopWorkload> TriggerRecoveryLoopWorkloadFactory("TriggerRecoveryLoop");

View File

@ -56,15 +56,15 @@ struct UnitPerfWorkload : TestWorkload {
enabled = !clientId; // only do this on the "first" client
}
virtual std::string description() { return "UnitPerfWorkload"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
virtual Future<Void> start( Database const& cx ) {
std::string description() const override { return "UnitPerfWorkload"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled)
return unitPerfTest();
return Void();
}
virtual Future<bool> check( Database const& cx ) { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {}
Future<bool> check(Database const& cx) override { return true; }
void getMetrics(vector<PerfMetric>& m) override {}
};
WorkloadFactory<UnitPerfWorkload> UnitPerfWorkloadFactory("UnitPerf");

View File

@ -51,15 +51,15 @@ struct UnitTestWorkload : TestWorkload {
forceLinkMemcpyPerfTests();
}
virtual std::string description() { return "UnitTests"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
virtual Future<Void> start(Database const& cx) {
std::string description() const override { return "UnitTests"; }
Future<Void> setup(Database const& cx) override { return Void(); }
Future<Void> start(Database const& cx) override {
if (enabled)
return runUnitTests(this);
return Void();
}
virtual Future<bool> check(Database const& cx) { return testsFailed.getValue() == 0; }
virtual void getMetrics(vector<PerfMetric>& m) {
Future<bool> check(Database const& cx) override { return testsFailed.getValue() == 0; }
void getMetrics(vector<PerfMetric>& m) override {
m.push_back(testsAvailable.getMetric());
m.push_back(testsExecuted.getMetric());
m.push_back(testsFailed.getMetric());

View File

@ -36,22 +36,19 @@ struct UnreadableWorkload : TestWorkload {
nodeCount = getOption( options, LiteralStringRef("nodeCount"), (uint64_t)100000 );
}
virtual std::string description() { return "Unreadable"; }
std::string description() const override { return "Unreadable"; }
virtual Future<Void> setup( Database const& cx ) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start( Database const& cx ) {
Future<Void> start(Database const& cx) override {
if (clientId == 0)
return _start( cx, this );
return Void();
}
virtual Future<bool> check( Database const& cx ) {
return true;
}
Future<bool> check(Database const& cx) override { return true; }
virtual void getMetrics( vector<PerfMetric>& m ) {
}
void getMetrics(vector<PerfMetric>& m) override {}
static Optional<KeyRef> containsUnreadable(KeyRangeMap<bool> & unreadableMap, KeyRangeRef const& range, bool forward) {
auto unreadableRanges = unreadableMap.intersectingRanges(range);

View File

@ -57,11 +57,11 @@ struct VersionStampWorkload : TestWorkload {
soleOwnerOfMetadataVersionKey = getOption(options, LiteralStringRef("soleOwnerOfMetadataVersionKey"), false);
}
virtual std::string description() { return "VersionStamp"; }
std::string description() const override { return "VersionStamp"; }
virtual Future<Void> setup(Database const& cx) { return Void(); }
Future<Void> setup(Database const& cx) override { return Void(); }
virtual Future<Void> start(Database const& cx) {
Future<Void> start(Database const& cx) override {
// Versionstamp behavior changed starting with API version 520, so
// choose a version to check compatibility.
double choice = deterministicRandom()->random01();
@ -131,7 +131,7 @@ struct VersionStampWorkload : TestWorkload {
return result;
}
virtual Future<bool> check(Database const& cx) {
Future<bool> check(Database const& cx) override {
if (clientId == 0)
return _check(cx, this);
return true;
@ -283,7 +283,7 @@ struct VersionStampWorkload : TestWorkload {
return true;
}
virtual void getMetrics(vector<PerfMetric>& m) {}
void getMetrics(vector<PerfMetric>& m) override {}
ACTOR Future<Void> _start(Database cx, VersionStampWorkload* self, double delay) {
state double startTime = now();

Some files were not shown because too many files have changed in this diff Show More