diff --git a/fdbrpc/PerfMetric.h b/fdbrpc/PerfMetric.h index 300f34a12a..f9c82846a8 100644 --- a/fdbrpc/PerfMetric.h +++ b/fdbrpc/PerfMetric.h @@ -58,8 +58,8 @@ struct PerfIntCounter { PerfIntCounter(std::string name, vector& 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(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& 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: diff --git a/fdbserver/tester.actor.cpp b/fdbserver/tester.actor.cpp index 70c95558fa..ca26cd106e 100644 --- a/fdbserver/tester.actor.cpp +++ b/fdbserver/tester.actor.cpp @@ -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; wdescription() + (w==workloads.size()-1?"":";"); return d; } - virtual Future setup( Database const& cx ) { + Future setup(Database const& cx) override { vector> all; for(int w=0; wsetup(cx) ); return waitForAll(all); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { vector> all; for(int w=0; wstart(cx) ); return waitForAll(all); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { vector> all; for(int w=0; wcheck(cx) ); return allTrue(all); } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { for(int w=0; w 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; wgetCheckTimeout(), m ); diff --git a/fdbserver/workloads/ApiCorrectness.actor.cpp b/fdbserver/workloads/ApiCorrectness.actor.cpp index d81412c268..f7afff7218 100644 --- a/fdbserver/workloads/ApiCorrectness.actor.cpp +++ b/fdbserver/workloads/ApiCorrectness.actor.cpp @@ -122,11 +122,9 @@ public: virtual ~ApiCorrectnessWorkload(){ } - std::string description() { - return "ApiCorrectness"; - } + std::string description() const override { return "ApiCorrectness"; } - void getMetrics(vector& m) { + void getMetrics(vector& m) override { m.push_back(PerfMetric("Number of Random Operations Performed", numRandomOperations.getValue(), false)); } diff --git a/fdbserver/workloads/ApiWorkload.h b/fdbserver/workloads/ApiWorkload.h index 0711fa8aa3..db5b8ff480 100644 --- a/fdbserver/workloads/ApiWorkload.h +++ b/fdbserver/workloads/ApiWorkload.h @@ -285,9 +285,9 @@ struct ApiWorkload : TestWorkload { } } - Future setup(Database const& cx); - Future start(Database const& cx); - Future check(Database const& cx); + Future setup(Database const& cx) override; + Future start(Database const& cx) override; + Future 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 compareDatabaseToMemory(); diff --git a/fdbserver/workloads/AsyncFileCorrectness.actor.cpp b/fdbserver/workloads/AsyncFileCorrectness.actor.cpp index 8aa9447ebb..8f437d21a8 100644 --- a/fdbserver/workloads/AsyncFileCorrectness.actor.cpp +++ b/fdbserver/workloads/AsyncFileCorrectness.actor.cpp @@ -97,13 +97,9 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload virtual ~AsyncFileCorrectnessWorkload(){ } - virtual std::string description() - { - return "AsyncFileCorrectness"; - } + std::string description() const override { return "AsyncFileCorrectness"; } - Future setup(Database const& cx) - { + Future setup(Database const& cx) override { if(enabled) return _setup(this); @@ -147,8 +143,7 @@ struct AsyncFileCorrectnessWorkload : public AsyncFileWorkload fileSize = newFileSize; } - Future start(Database const& cx) - { + Future 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 check(Database const& cx) - { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics(vector& m) - { + void getMetrics(vector& m) override { if(enabled) { m.push_back(PerfMetric("Number of Operations Performed", numOperations.getValue(), false)); diff --git a/fdbserver/workloads/AsyncFileRead.actor.cpp b/fdbserver/workloads/AsyncFileRead.actor.cpp index 7362bf8bb4..f537d624cf 100644 --- a/fdbserver/workloads/AsyncFileRead.actor.cpp +++ b/fdbserver/workloads/AsyncFileRead.actor.cpp @@ -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 setup(Database const& cx) - { + Future setup(Database const& cx) override { if(enabled) return _setup(this); @@ -213,8 +209,7 @@ struct AsyncFileReadWorkload : public AsyncFileWorkload return Void(); } - virtual Future start(Database const& cx) - { + Future start(Database const& cx) override { if(enabled) return _start(this); @@ -335,7 +330,7 @@ struct AsyncFileReadWorkload : public AsyncFileWorkload } } - virtual void getMetrics(std::vector& m) { + void getMetrics(std::vector& m) override { if (enabled) { m.emplace_back("Bytes read/sec", bytesRead.getValue() / testDuration, false); m.emplace_back("Average CPU Utilization (Percentage)", averageCpuUtilization * 100, false); diff --git a/fdbserver/workloads/AsyncFileWrite.actor.cpp b/fdbserver/workloads/AsyncFileWrite.actor.cpp index 44cccc237e..ead1f851e5 100644 --- a/fdbserver/workloads/AsyncFileWrite.actor.cpp +++ b/fdbserver/workloads/AsyncFileWrite.actor.cpp @@ -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 setup(Database const& cx) - { + Future setup(Database const& cx) override { if(enabled) return _setup(this); @@ -91,8 +85,7 @@ struct AsyncFileWriteWorkload : public AsyncFileWorkload return Void(); } - virtual Future start(Database const& cx) - { + Future start(Database const& cx) override { if(enabled) return _start(this); @@ -162,8 +155,7 @@ struct AsyncFileWriteWorkload : public AsyncFileWorkload } } - virtual void getMetrics(vector& m) - { + void getMetrics(vector& m) override { if(enabled) { m.push_back(PerfMetric("Bytes written/sec", bytesWritten.getValue() / testDuration, false)); diff --git a/fdbserver/workloads/AtomicOps.actor.cpp b/fdbserver/workloads/AtomicOps.actor.cpp index 1307e3c9ce..70b933ed16 100644 --- a/fdbserver/workloads/AtomicOps.actor.cpp +++ b/fdbserver/workloads/AtomicOps.actor.cpp @@ -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 setup( Database const& cx ) { + Future setup(Database const& cx) override { if (apiVersion500) cx->apiVersion = 500; @@ -119,7 +119,7 @@ struct AtomicOpsWorkload : TestWorkload { return _setup( cx, this ); } - virtual Future start( Database const& cx ) { + Future 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 check( Database const& cx ) { + Future check(Database const& cx) override { if(clientId != 0) return true; return _check( cx, this ); } - virtual void getMetrics( vector& m ) { - } + void getMetrics(vector& m) override {} std::pair logDebugKey(int group) { Key logKey(format("log%08x%08x%08x", group, clientId, opNum)); diff --git a/fdbserver/workloads/AtomicOpsApiCorrectness.actor.cpp b/fdbserver/workloads/AtomicOpsApiCorrectness.actor.cpp index 2c63620085..03f80db936 100644 --- a/fdbserver/workloads/AtomicOpsApiCorrectness.actor.cpp +++ b/fdbserver/workloads/AtomicOpsApiCorrectness.actor.cpp @@ -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 setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (opType == -1) opType = sharedRandomNumber % 9; @@ -94,12 +92,9 @@ public: return Void(); } - virtual Future check(Database const& cx) { - return !testFailed; - } + Future check(Database const& cx) override { return !testFailed; } - virtual void getMetrics(vector& m) { - } + virtual void getMetrics(vector& m) override {} // Test Atomic ops on non existing keys that results in a set ACTOR Future testAtomicOpSetOnNonExistingKey(Database cx, AtomicOpsApiCorrectnessWorkload* self, uint32_t opType, Key key) { diff --git a/fdbserver/workloads/AtomicRestore.actor.cpp b/fdbserver/workloads/AtomicRestore.actor.cpp index d504f162c4..4e4f53e5e5 100644 --- a/fdbserver/workloads/AtomicRestore.actor.cpp +++ b/fdbserver/workloads/AtomicRestore.actor.cpp @@ -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 setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} - bool hasPrefix() { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); } + bool hasPrefix() const { return addPrefix != LiteralStringRef("") || removePrefix != LiteralStringRef(""); } ACTOR static Future _start(Database cx, AtomicRestoreWorkload* self) { state FileBackupAgent backupAgent; diff --git a/fdbserver/workloads/AtomicSwitchover.actor.cpp b/fdbserver/workloads/AtomicSwitchover.actor.cpp index c5f298b1da..64450d800f 100644 --- a/fdbserver/workloads/AtomicSwitchover.actor.cpp +++ b/fdbserver/workloads/AtomicSwitchover.actor.cpp @@ -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 setup(Database const& cx) { + Future 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 start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future diffRanges(Standalone> ranges, StringRef backupPrefix, Database src, Database dest) { state int rangeIndex; diff --git a/fdbserver/workloads/BackgroundSelectors.actor.cpp b/fdbserver/workloads/BackgroundSelectors.actor.cpp index 5e5793cdb1..e30337e09d 100644 --- a/fdbserver/workloads/BackgroundSelectors.actor.cpp +++ b/fdbserver/workloads/BackgroundSelectors.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _start( Database cx, BackgroundSelectorWorkload *self ) { for(int c=0; cactorsPerClient; c++) @@ -68,7 +64,7 @@ struct BackgroundSelectorWorkload : TestWorkload { return Void(); } - virtual Future check( Database const& cx ) { + Future 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& m ) { + void getMetrics(vector& m) override { double duration = testDuration; m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) ); m.push_back( operations.getMetric() ); diff --git a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp index a3d7b45792..6686de9bf1 100644 --- a/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupAndParallelRestoreCorrectness.actor.cpp @@ -136,11 +136,11 @@ struct BackupAndParallelRestoreCorrectnessWorkload : TestWorkload { } } - virtual std::string description() { return "BackupAndParallelRestoreCorrectness"; } + std::string description() const override { return "BackupAndParallelRestoreCorrectness"; } - virtual Future setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future 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 check(Database const& cx) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} ACTOR static Future changePaused(Database cx, FileBackupAgent* backupAgent) { loop { diff --git a/fdbserver/workloads/BackupCorrectness.actor.cpp b/fdbserver/workloads/BackupCorrectness.actor.cpp index f1eb1c6b9b..fac28ce5cd 100644 --- a/fdbserver/workloads/BackupCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupCorrectness.actor.cpp @@ -118,15 +118,11 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { } } - virtual std::string description() { - return "BackupAndRestoreCorrectness"; - } + std::string description() const override { return "BackupAndRestoreCorrectness"; } - virtual Future setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); @@ -145,7 +141,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { return _start(cx, this); } - virtual Future check(Database const& cx) { + Future check(Database const& cx) override { if (clientId != 0) return true; else @@ -175,8 +171,7 @@ struct BackupAndRestoreCorrectnessWorkload : TestWorkload { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future changePaused(Database cx, FileBackupAgent* backupAgent) { loop { diff --git a/fdbserver/workloads/BackupToDBAbort.actor.cpp b/fdbserver/workloads/BackupToDBAbort.actor.cpp index 7d242360ec..53ceed1bd7 100644 --- a/fdbserver/workloads/BackupToDBAbort.actor.cpp +++ b/fdbserver/workloads/BackupToDBAbort.actor.cpp @@ -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 setup(const Database& cx) override { + Future 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 start(Database const& cx) override { + Future 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 check(const Database& cx) override { - return _check(this, cx); - } + Future check(const Database& cx) override { return _check(this, cx); } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; REGISTER_WORKLOAD(BackupToDBAbort); diff --git a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp index d058f408b2..76fdf6751a 100644 --- a/fdbserver/workloads/BackupToDBCorrectness.actor.cpp +++ b/fdbserver/workloads/BackupToDBCorrectness.actor.cpp @@ -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 setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future diffRanges(Standalone> ranges, StringRef backupPrefix, Database src, Database dest) { state int rangeIndex; diff --git a/fdbserver/workloads/BackupToDBUpgrade.actor.cpp b/fdbserver/workloads/BackupToDBUpgrade.actor.cpp index efcc722d35..55a818c32f 100644 --- a/fdbserver/workloads/BackupToDBUpgrade.actor.cpp +++ b/fdbserver/workloads/BackupToDBUpgrade.actor.cpp @@ -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 setup(Database const& cx) { + Future setup(Database const& cx) override { if (clientId != 0) return Void(); return _setup(cx, this); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future doBackup(BackupToDBUpgradeWorkload* self, DatabaseBackupAgent* backupAgent, Database cx, Key tag, Standalone> backupRanges) { try { diff --git a/fdbserver/workloads/BulkLoad.actor.cpp b/fdbserver/workloads/BulkLoad.actor.cpp index b46a10c581..7f4affd21e 100644 --- a/fdbserver/workloads/BulkLoad.actor.cpp +++ b/fdbserver/workloads/BulkLoad.actor.cpp @@ -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 start( Database const& cx ) { + Future 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 check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); m.push_back( PerfMetric( "Rows written", transactions.getValue() * writesPerTransaction, false ) ); diff --git a/fdbserver/workloads/Cache.actor.cpp b/fdbserver/workloads/Cache.actor.cpp index e4ca88c77e..2ead1248b1 100644 --- a/fdbserver/workloads/Cache.actor.cpp +++ b/fdbserver/workloads/Cache.actor.cpp @@ -12,22 +12,17 @@ struct CacheWorkload : TestWorkload { keyPrefix = unprintable( getOption(options, LiteralStringRef("keyPrefix"), LiteralStringRef("")).toString() ); } - virtual std::string description() { return "CacheWorkload"; } - virtual Future 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 start( Database const& cx ) { - return Void(); - } - virtual Future check( Database const& cx ) { - return true; - } - virtual void getMetrics( vector& m ) { + std::string description() const override { return "CacheWorkload"; } + Future 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 start(Database const& cx) override { return Void(); } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} }; WorkloadFactory CacheWorkloadFactory("Cache"); diff --git a/fdbserver/workloads/ChangeConfig.actor.cpp b/fdbserver/workloads/ChangeConfig.actor.cpp index 6235e656d2..e7e23ea8fa 100644 --- a/fdbserver/workloads/ChangeConfig.actor.cpp +++ b/fdbserver/workloads/ChangeConfig.actor.cpp @@ -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 start( Database const& cx ) { + Future start(Database const& cx) override { if( this->clientId != 0 ) return Void(); return ChangeConfigClient( cx->clone(), this ); } - virtual Future check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) {} + void getMetrics(vector& m) override {} ACTOR Future extraDatabaseConfigure(ChangeConfigWorkload *self) { if (g_network->isSimulated() && g_simulator.extraDB) { diff --git a/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp b/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp index 4ec2110abc..e160312718 100644 --- a/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp +++ b/fdbserver/workloads/ClientTransactionProfileCorrectness.actor.cpp @@ -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 setup(Database const& cx) { + Future setup(Database const& cx) override { if (clientId == 0) { const_cast(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 start(Database const& cx) { - return Void(); - } + Future start(Database const& cx) override { return Void(); } - int getNumChunks(KeyRef key) { + int getNumChunks(KeyRef key) const { return bigEndian32(BinaryReader::fromStringRef(key.substr(numChunksStartIndex, chunkFormatSize), Unversioned())); } - int getChunkNum(KeyRef key) { + int getChunkNum(KeyRef key) const { return bigEndian32(BinaryReader::fromStringRef(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 &txInfoEntries) { std::string val; @@ -337,15 +333,13 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload { return self->checkTxInfoEntriesFormat(txInfoEntries); } - virtual Future check(Database const& cx) { + Future check(Database const& cx) override { if (clientId != 0) return true; return _check(cx, this); } - virtual void getMetrics(vector& m) { - } - + void getMetrics(vector& m) override {} }; WorkloadFactory ClientTransactionProfileCorrectnessWorkloadFactory("ClientTransactionProfileCorrectness"); diff --git a/fdbserver/workloads/CommitBugCheck.actor.cpp b/fdbserver/workloads/CommitBugCheck.actor.cpp index 8dbea9ec57..c8eef36922 100644 --- a/fdbserver/workloads/CommitBugCheck.actor.cpp +++ b/fdbserver/workloads/CommitBugCheck.actor.cpp @@ -33,20 +33,11 @@ struct CommitBugWorkload : TestWorkload success = true; } - virtual std::string description() - { - return "CommitBugWorkload"; - } + std::string description() const override { return "CommitBugWorkload"; } - virtual Future setup(Database const& cx) - { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) - { - return timeout(bug1(cx, this) && bug2(cx, this), 60, Void()); - } + Future start(Database const& cx) override { return timeout(bug1(cx, this) && bug2(cx, this), 60, Void()); } ACTOR Future bug1(Database cx, CommitBugWorkload *self) { @@ -170,15 +161,9 @@ struct CommitBugWorkload : TestWorkload return Void(); } - virtual Future check(Database const& cx) - { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics( vector& m ) - { - - } + void getMetrics(vector& m) override {} }; WorkloadFactory CommitBugWorkloadFactory("CommitBug"); diff --git a/fdbserver/workloads/ConfigureDatabase.actor.cpp b/fdbserver/workloads/ConfigureDatabase.actor.cpp index 71fa36022f..552edfe635 100644 --- a/fdbserver/workloads/ConfigureDatabase.actor.cpp +++ b/fdbserver/workloads/ConfigureDatabase.actor.cpp @@ -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 setup( Database const& cx ) { - return _setup( cx, this ); - } + Future setup(Database const& cx) override { return _setup(cx, this); } - virtual Future start( Database const& cx ) { - return _start( this, cx ); - } - virtual Future check( Database const& cx ) { - return true; - } + Future start(Database const& cx) override { return _start(this, cx); } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { - m.push_back( retries.getMetric() ); - } + void getMetrics(vector& m) override { m.push_back(retries.getMetric()); } static inline uint64_t valueToUInt64( const StringRef& v ) { long long unsigned int x = 0; diff --git a/fdbserver/workloads/ConflictRange.actor.cpp b/fdbserver/workloads/ConflictRange.actor.cpp index de40893bed..a8a7a5b6d3 100644 --- a/fdbserver/workloads/ConflictRange.actor.cpp +++ b/fdbserver/workloads/ConflictRange.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( withConflicts.getMetric() ); m.push_back( withoutConflicts.getMetric() ); m.push_back( retries.getMetric() ); diff --git a/fdbserver/workloads/ConsistencyCheck.actor.cpp b/fdbserver/workloads/ConsistencyCheck.actor.cpp index f1ab535116..3c958dc478 100644 --- a/fdbserver/workloads/ConsistencyCheck.actor.cpp +++ b/fdbserver/workloads/ConsistencyCheck.actor.cpp @@ -105,15 +105,9 @@ struct ConsistencyCheckWorkload : TestWorkload bytesReadInPreviousRound = 0; } - virtual std::string description() - { - return "ConsistencyCheck"; - } + std::string description() const override { return "ConsistencyCheck"; } - virtual Future setup(Database const& cx) - { - return _setup(cx, this); - } + Future setup(Database const& cx) override { return _setup(cx, this); } ACTOR Future _setup(Database cx, ConsistencyCheckWorkload *self) { @@ -139,21 +133,14 @@ struct ConsistencyCheckWorkload : TestWorkload return Void(); } - virtual Future start(Database const& cx) - { + Future start(Database const& cx) override { TraceEvent("ConsistencyCheck"); return _start(cx, this); } - virtual Future check(Database const& cx) - { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics( vector& m ) - { - - } + void getMetrics(vector& m) override {} void testFailure(std::string message, bool isError = false) { diff --git a/fdbserver/workloads/CpuProfiler.actor.cpp b/fdbserver/workloads/CpuProfiler.actor.cpp index 8e8c8865de..8fa76f6e56 100644 --- a/fdbserver/workloads/CpuProfiler.actor.cpp +++ b/fdbserver/workloads/CpuProfiler.actor.cpp @@ -51,15 +51,9 @@ struct CpuProfilerWorkload : TestWorkload success = true; } - virtual std::string description() - { - return "CpuProfiler"; - } + std::string description() const override { return "CpuProfiler"; } - virtual Future setup(Database const& cx) - { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } //Turns the profiler on or off ACTOR Future updateProfiler(bool enabled, Database cx, CpuProfilerWorkload *self) @@ -110,10 +104,7 @@ struct CpuProfilerWorkload : TestWorkload return Void(); } - virtual Future start(Database const& cx) - { - return _start(cx, this); - } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _start(Database cx, CpuProfilerWorkload *self) { @@ -134,10 +125,7 @@ struct CpuProfilerWorkload : TestWorkload return Void(); } - virtual Future check(Database const& cx) - { - return _check(cx, this); - } + Future check(Database const& cx) override { return _check(cx, this); } ACTOR Future _check(Database cx, CpuProfilerWorkload *self) { @@ -152,10 +140,7 @@ struct CpuProfilerWorkload : TestWorkload return self->success; } - virtual void getMetrics( vector& m ) - { - - } + void getMetrics(vector& m) override {} }; WorkloadFactory CpuProfilerWorkloadFactory("CpuProfiler"); diff --git a/fdbserver/workloads/Cycle.actor.cpp b/fdbserver/workloads/Cycle.actor.cpp index b3098865d4..a0e215ddb1 100644 --- a/fdbserver/workloads/Cycle.actor.cpp +++ b/fdbserver/workloads/Cycle.actor.cpp @@ -53,18 +53,16 @@ struct CycleWorkload : TestWorkload { minExpectedTransactionsPerSecond = transactionsPerSecond * getOption(options, "expectedRate"_sr, 0.7); } - virtual std::string description() { return "CycleWorkload"; } - virtual Future setup( Database const& cx ) { - return bulkSetup( cx, this, nodeCount, Promise() ); - } - virtual Future start( Database const& cx ) { + std::string description() const override { return "CycleWorkload"; } + Future setup(Database const& cx) override { return bulkSetup(cx, this, nodeCount, Promise()); } + Future start(Database const& cx) override { for(int c=0; cclone(), this, actorCount / transactionsPerSecond ), testDuration, Void()) ); return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { int errors = 0; for(int c=0; cclone(), this, !errors ); } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); m.push_back( tooOldRetries.getMetric() ); diff --git a/fdbserver/workloads/DDBalance.actor.cpp b/fdbserver/workloads/DDBalance.actor.cpp index 5189ca817b..afe89c0fd6 100644 --- a/fdbserver/workloads/DDBalance.actor.cpp +++ b/fdbserver/workloads/DDBalance.actor.cpp @@ -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 setup( Database const& cx ) { - return ddbalanceSetup( cx, this ); - } + Future setup(Database const& cx) override { return ddbalanceSetup(cx, this); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _start( Database cx, DDBalanceWorkload *self ) { for(int c=0; cmoversPerClient; c++) @@ -72,7 +68,7 @@ struct DDBalanceWorkload : TestWorkload { return Void(); } - virtual Future check( Database const& cx ) { + Future 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& m ) { + void getMetrics(vector& 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() ); diff --git a/fdbserver/workloads/DDMetrics.actor.cpp b/fdbserver/workloads/DDMetrics.actor.cpp index b93bf6bed5..a18d245eef 100644 --- a/fdbserver/workloads/DDMetrics.actor.cpp +++ b/fdbserver/workloads/DDMetrics.actor.cpp @@ -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 getHighPriorityRelocationsInFlight( Database cx, DDMetricsWorkload *self ) { WorkerInterface masterWorker = wait(getMasterWorker(cx, self->dbInfo)); @@ -69,18 +69,11 @@ struct DDMetricsWorkload : TestWorkload { return Void(); } - virtual Future start( Database const& cx ) { - return clientId == 0 ? work( cx, this ) : Void(); - } + Future start(Database const& cx) override { return clientId == 0 ? work(cx, this) : Void(); } - virtual Future check( Database const& cx ) { - return true; - } - - virtual void getMetrics( vector& m ) { - m.push_back( PerfMetric( "DDDuration", ddDone, false ) ); - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override { m.push_back(PerfMetric("DDDuration", ddDone, false)); } }; WorkloadFactory DDMetricsWorkloadFactory("DDMetrics"); diff --git a/fdbserver/workloads/DDMetricsExclude.actor.cpp b/fdbserver/workloads/DDMetricsExclude.actor.cpp index e616eeb8b1..0a10d1ba54 100644 --- a/fdbserver/workloads/DDMetricsExclude.actor.cpp +++ b/fdbserver/workloads/DDMetricsExclude.actor.cpp @@ -90,22 +90,21 @@ struct DDMetricsExcludeWorkload : TestWorkload { return Void(); } - virtual std::string description() { return "Data Distribution Metrics Exclude"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { return _start(cx, this); } - virtual Future check( Database const& cx ) { + std::string description() const override { return "Data Distribution Metrics Exclude"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { return _start(cx, this); } + Future check(Database const& cx) override { movingDataPerSec = peakMovingData / ddDone; return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& 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 DDMetricsExcludeWorkloadFactory("DDMetricsExclude"); diff --git a/fdbserver/workloads/DataDistributionMetrics.actor.cpp b/fdbserver/workloads/DataDistributionMetrics.actor.cpp index 65636c3f34..b9c149ba45 100644 --- a/fdbserver/workloads/DataDistributionMetrics.actor.cpp +++ b/fdbserver/workloads/DataDistributionMetrics.actor.cpp @@ -184,12 +184,12 @@ struct DataDistributionMetricsWorkload : KVWorkload { return Void(); } - virtual std::string description() { return "DataDistributionMetrics"; } - virtual Future setup(Database const& cx) { return Void(); } - virtual Future start(Database const& cx) { return _start(cx, this); } - virtual Future check(Database const& cx) { return _check(cx, this); } + std::string description() const override { return "DataDistributionMetrics"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { return _start(cx, this); } + Future check(Database const& cx) override { return _check(cx, this); } - virtual void getMetrics(vector& m) { + void getMetrics(vector& m) override { m.push_back(PerfMetric("NumShards", numShards, true)); m.push_back(PerfMetric("AvgBytes", avgBytes, true)); m.push_back(commits.getMetric()); diff --git a/fdbserver/workloads/DifferentClustersSameRV.actor.cpp b/fdbserver/workloads/DifferentClustersSameRV.actor.cpp index 18a5bc269a..724872d1b3 100644 --- a/fdbserver/workloads/DifferentClustersSameRV.actor.cpp +++ b/fdbserver/workloads/DifferentClustersSameRV.actor.cpp @@ -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 setup(Database const& cx) override { return Void(); } diff --git a/fdbserver/workloads/DiskDurability.actor.cpp b/fdbserver/workloads/DiskDurability.actor.cpp index e44b11fc5c..32b9291b1d 100755 --- a/fdbserver/workloads/DiskDurability.actor.cpp +++ b/fdbserver/workloads/DiskDurability.actor.cpp @@ -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 setup(Database const& cx) - { + Future setup(Database const& cx) override { if(enabled) return _setup(this); @@ -137,8 +133,7 @@ struct DiskDurabilityWorkload : public AsyncFileWorkload return Void(); } - virtual Future start(Database const& cx) - { + Future start(Database const& cx) override { if(enabled) return _start(this); @@ -185,9 +180,7 @@ struct DiskDurabilityWorkload : public AsyncFileWorkload return Void(); } - virtual void getMetrics(vector& m) - { - } + void getMetrics(vector& m) override {} }; WorkloadFactory DiskDurabilityWorkloadFactory("DiskDurability"); diff --git a/fdbserver/workloads/DiskDurabilityTest.actor.cpp b/fdbserver/workloads/DiskDurabilityTest.actor.cpp index 8a9a3bf7f0..6f6087d4fc 100755 --- a/fdbserver/workloads/DiskDurabilityTest.actor.cpp +++ b/fdbserver/workloads/DiskDurabilityTest.actor.cpp @@ -39,36 +39,34 @@ struct DiskDurabilityTest : TestWorkload { metrics = prefixRange( prefix ); } - virtual std::string description() { return "DiskDurabilityTest"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "DiskDurabilityTest"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if (enabled) return durabilityTest(this, cx); return Void(); } - virtual Future check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) {} + Future check(Database const& cx) override { return true; } + void getMetrics(vector& 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) diff --git a/fdbserver/workloads/Downgrade.actor.cpp b/fdbserver/workloads/Downgrade.actor.cpp index 4ec5704f6f..e6b9d47caa 100644 --- a/fdbserver/workloads/Downgrade.actor.cpp +++ b/fdbserver/workloads/Downgrade.actor.cpp @@ -150,7 +150,7 @@ struct DowngradeWorkload : TestWorkload { return Void(); } - std::string description() override { return NAME; } + std::string description() const override { return NAME; } Future setup(Database const& cx) override { return clientId ? Void() : (writeOld(cx, numObjects, oldKey) && writeNew(cx, numObjects, newKey)); diff --git a/fdbserver/workloads/DummyWorkload.actor.cpp b/fdbserver/workloads/DummyWorkload.actor.cpp index d430f4a7b5..e6cc413a54 100644 --- a/fdbserver/workloads/DummyWorkload.actor.cpp +++ b/fdbserver/workloads/DummyWorkload.actor.cpp @@ -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 start(Database const& cx) { + Future start(Database const& cx) override { if ((clientId == 0) && (displayWorkers)) { return _start(this, cx); } @@ -50,12 +48,9 @@ struct DummyWorkload : TestWorkload { return Void(); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} }; WorkloadFactory DummyWorkloadFactory("DummyWorkload"); diff --git a/fdbserver/workloads/ExternalWorkload.actor.cpp b/fdbserver/workloads/ExternalWorkload.actor.cpp index 5a0bb4a92b..c50fc1651b 100644 --- a/fdbserver/workloads/ExternalWorkload.actor.cpp +++ b/fdbserver/workloads/ExternalWorkload.actor.cpp @@ -166,7 +166,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext { } } - std::string description() override { return NAME; } + std::string description() const override { return NAME; } ACTOR Future assertTrue(StringRef stage, Future f) { bool res = wait(f); @@ -230,7 +230,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext { } } - double getCheckTimeout() override { + double getCheckTimeout() const override { if (!success) { return 3000; } diff --git a/fdbserver/workloads/FastTriggeredWatches.actor.cpp b/fdbserver/workloads/FastTriggeredWatches.actor.cpp index 371bd4d159..335aba2b68 100644 --- a/fdbserver/workloads/FastTriggeredWatches.actor.cpp +++ b/fdbserver/workloads/FastTriggeredWatches.actor.cpp @@ -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 setup( Database const& cx ) { + Future 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 start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return _start( cx, this ); return Void(); @@ -146,7 +146,7 @@ struct FastTriggeredWatchesWorkload : TestWorkload { } } - virtual Future check( Database const& cx ) { + Future 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& m ) { + void getMetrics(vector& 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); diff --git a/fdbserver/workloads/FileSystem.actor.cpp b/fdbserver/workloads/FileSystem.actor.cpp index 89c1029e4c..2c6053b852 100644 --- a/fdbserver/workloads/FileSystem.actor.cpp +++ b/fdbserver/workloads/FileSystem.actor.cpp @@ -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 setup( Database const& cx ) { - return nodeSetup( cx, this ); - } + Future setup(Database const& cx) override { return nodeSetup(cx, this); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& 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 ) ); diff --git a/fdbserver/workloads/Fuzz.cpp b/fdbserver/workloads/Fuzz.cpp index d9d51778dc..186228fa73 100644 --- a/fdbserver/workloads/Fuzz.cpp +++ b/fdbserver/workloads/Fuzz.cpp @@ -32,9 +32,9 @@ struct ActorFuzzWorkload : TestWorkload { enabled = !clientId; // only do this on the "first" client } - virtual std::string description() { return "ActorFuzzWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "ActorFuzzWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future 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 check( Database const& cx ) { return fuzzResults.first == fuzzResults.second; } - virtual void getMetrics( vector& m ) {} + Future check(Database const& cx) override { return fuzzResults.first == fuzzResults.second; } + void getMetrics(vector& m) override {} }; WorkloadFactory ActorFuzzWorkloadFactory("ActorFuzz"); diff --git a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp index 0923f73287..2f65000c6b 100644 --- a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp +++ b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp @@ -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 start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) { return loadAndRun( cx, this ); } return Void(); } - virtual Future check( Database const& cx ) { - return success; - } + Future 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& m ) { + void getMetrics(vector& m) override { //m.push_back( transactions.getMetric() ); //m.push_back( retries.getMetric() ); } diff --git a/fdbserver/workloads/HealthMetricsApi.actor.cpp b/fdbserver/workloads/HealthMetricsApi.actor.cpp index 706da1a3e3..76ccf24624 100644 --- a/fdbserver/workloads/HealthMetricsApi.actor.cpp +++ b/fdbserver/workloads/HealthMetricsApi.actor.cpp @@ -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 _setup(Database cx, HealthMetricsApiWorkload* self) { if (!self->sendDetailedHealthMetrics) { @@ -64,14 +64,14 @@ struct HealthMetricsApiWorkload : TestWorkload { } return Void(); } - virtual Future setup(Database const& cx) { return _setup(cx, this); } + Future setup(Database const& cx) override { return _setup(cx, this); } ACTOR static Future _start(Database cx, HealthMetricsApiWorkload* self) { wait(timeout(healthMetricsChecker(cx, self), self->testDuration, Void())); return Void(); } - virtual Future start(Database const& cx) { return _start(cx, this); } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check(Database const& cx) { + Future 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& m) { + void getMetrics(vector& m) override { m.push_back(PerfMetric("WorstStorageQueue", worstStorageQueue, true)); m.push_back(PerfMetric("DetailedWorstStorageQueue", detailedWorstStorageQueue, true)); m.push_back(PerfMetric("WorstStorageDurabilityLag", worstStorageDurabilityLag, true)); diff --git a/fdbserver/workloads/Increment.actor.cpp b/fdbserver/workloads/Increment.actor.cpp index fd0484d8dc..47ba37e2b7 100644 --- a/fdbserver/workloads/Increment.actor.cpp +++ b/fdbserver/workloads/Increment.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } - virtual Future start( Database const& cx ) { + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { for(int c=0; cclone(), this, actorCount / transactionsPerSecond ), testDuration, Void()) ); return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { int errors = 0; for(int c=0; cclone(), this, !errors ); } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); m.push_back( tooOldRetries.getMetric() ); diff --git a/fdbserver/workloads/IncrementalBackup.actor.cpp b/fdbserver/workloads/IncrementalBackup.actor.cpp index 26953ba132..69124285b3 100644 --- a/fdbserver/workloads/IncrementalBackup.actor.cpp +++ b/fdbserver/workloads/IncrementalBackup.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId) { return Void(); } return _start(cx, this); } - virtual Future check(Database const& cx) { + Future check(Database const& cx) override { if (clientId) { return true; } @@ -175,7 +175,7 @@ struct IncrementalBackupWorkload : TestWorkload { return Void(); } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; WorkloadFactory IncrementalBackupWorkloadFactory("IncrementalBackup"); diff --git a/fdbserver/workloads/IndexScan.actor.cpp b/fdbserver/workloads/IndexScan.actor.cpp index 29d5f38b0a..a8168270e6 100644 --- a/fdbserver/workloads/IndexScan.actor.cpp +++ b/fdbserver/workloads/IndexScan.actor.cpp @@ -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 setup( Database const& cx ) { + Future setup(Database const& cx) override { // this will be set up by and external force! return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( singleProcess && clientId != 0 ) { return Void(); } return _start( cx, this ); } - virtual Future check(const Database&) { return true; } + Future check(const Database&) override { return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { if( singleProcess && clientId != 0 ) return; diff --git a/fdbserver/workloads/Inventory.actor.cpp b/fdbserver/workloads/Inventory.actor.cpp index 9be8072427..b9ed5a758b 100644 --- a/fdbserver/workloads/Inventory.actor.cpp +++ b/fdbserver/workloads/Inventory.actor.cpp @@ -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 start( Database const& cx ) { + Future start(Database const& cx) override { if (clientId) return Void(); for(int c=0; c check( Database const& cx ) { + Future check(Database const& cx) override { if (clientId) return true; return inventoryTestCheck(cx->clone(), this); } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& 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); diff --git a/fdbserver/workloads/KVStoreTest.actor.cpp b/fdbserver/workloads/KVStoreTest.actor.cpp index 1db583cd26..3f5b0685a9 100755 --- a/fdbserver/workloads/KVStoreTest.actor.cpp +++ b/fdbserver/workloads/KVStoreTest.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } - virtual Future start(Database const& cx) { + std::string description() const override { return "KVStoreTest"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if (enabled) return testKVStore(this); return Void(); } - virtual Future check(Database const& cx) { return true; } - void metricsFromHistogram(vector& m, std::string name, Histogram& h) { + Future check(Database const& cx) override { return true; } + void metricsFromHistogram(vector& m, std::string name, Histogram& 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& m) { + void getMetrics(vector& m) override { if (setupTook) m.push_back(PerfMetric("SetupTook", setupTook, false)); m.push_back(reads.getMetric()); diff --git a/fdbserver/workloads/KillRegion.actor.cpp b/fdbserver/workloads/KillRegion.actor.cpp index 50d01e2fa4..06759e91ec 100644 --- a/fdbserver/workloads/KillRegion.actor.cpp +++ b/fdbserver/workloads/KillRegion.actor.cpp @@ -40,22 +40,21 @@ struct KillRegionWorkload : TestWorkload { g_simulator.usableRegions = 1; } - virtual std::string description() { return "KillRegionWorkload"; } - virtual Future setup( Database const& cx ) { + std::string description() const override { return "KillRegionWorkload"; } + Future setup(Database const& cx) override { if(enabled) { return _setup( this, cx ); } return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if(enabled) { return killRegion( this, cx ); } return Void(); } - virtual Future check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} ACTOR static Future _setup( KillRegionWorkload *self, Database cx ) { TraceEvent("ForceRecovery_DisablePrimaryBegin"); diff --git a/fdbserver/workloads/LocalRatekeeper.actor.cpp b/fdbserver/workloads/LocalRatekeeper.actor.cpp index 89022b509a..529bdbba61 100644 --- a/fdbserver/workloads/LocalRatekeeper.actor.cpp +++ b/fdbserver/workloads/LocalRatekeeper.actor.cpp @@ -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 testStorage(LocalRatekeeperWorkload* self, Database cx, StorageServerInterface ssi) { state Transaction tr(cx); @@ -123,15 +123,15 @@ struct LocalRatekeeperWorkload : TestWorkload { return Void(); } - virtual Future start(Database const& cx) { + Future 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 check(Database const& cx) { return !testFailed; } - virtual void getMetrics(vector& m) {} + Future check(Database const& cx) override { return !testFailed; } + void getMetrics(vector& m) override {} }; } // namespace diff --git a/fdbserver/workloads/LockDatabase.actor.cpp b/fdbserver/workloads/LockDatabase.actor.cpp index 9c9d51a6e9..751822bf15 100644 --- a/fdbserver/workloads/LockDatabase.actor.cpp +++ b/fdbserver/workloads/LockDatabase.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId == 0) return onlyCheckLocked ? timeout(checkLocked(cx, this), 60, Void()) : lockWorker(cx, this); return Void(); } - virtual Future check( Database const& cx ) { - return ok; - } + Future check(Database const& cx) override { return ok; } - virtual void getMetrics( vector& m ) { - } + void getMetrics(vector& m) override {} ACTOR static Future> lockAndSave( Database cx, LockDatabaseWorkload* self, UID lockID ) { state Transaction tr(cx); diff --git a/fdbserver/workloads/LockDatabaseFrequently.actor.cpp b/fdbserver/workloads/LockDatabaseFrequently.actor.cpp index b252e33a3e..175632543a 100644 --- a/fdbserver/workloads/LockDatabaseFrequently.actor.cpp +++ b/fdbserver/workloads/LockDatabaseFrequently.actor.cpp @@ -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 setup(Database const& cx) override { return Void(); } diff --git a/fdbserver/workloads/LogMetrics.actor.cpp b/fdbserver/workloads/LogMetrics.actor.cpp index afce9c9755..03a44bf5ac 100644 --- a/fdbserver/workloads/LogMetrics.actor.cpp +++ b/fdbserver/workloads/LogMetrics.actor.cpp @@ -43,9 +43,9 @@ struct LogMetricsWorkload : TestWorkload { dataFolder = getOption( options, LiteralStringRef("dataFolder"), LiteralStringRef("") ).toString(); } - virtual std::string description() { return "LogMetricsWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "LogMetricsWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if(clientId) return Void(); return _start( cx, this ); @@ -92,9 +92,8 @@ struct LogMetricsWorkload : TestWorkload { return Void(); } - virtual Future check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} }; WorkloadFactory LogMetricsWorkloadFactory("LogMetrics"); diff --git a/fdbserver/workloads/LowLatency.actor.cpp b/fdbserver/workloads/LowLatency.actor.cpp index f9d807f095..afd194637e 100644 --- a/fdbserver/workloads/LowLatency.actor.cpp +++ b/fdbserver/workloads/LowLatency.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return _start( cx, this ); return Void(); @@ -102,11 +100,9 @@ struct LowLatencyWorkload : TestWorkload { } } - virtual Future check( Database const& cx ) { - return ok; - } + Future check(Database const& cx) override { return ok; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { double duration = testDuration; m.push_back( PerfMetric( "Operations/sec", operations.getValue() / duration, false ) ); m.push_back( operations.getMetric() ); diff --git a/fdbserver/workloads/MachineAttrition.actor.cpp b/fdbserver/workloads/MachineAttrition.actor.cpp index 5a666bf887..4245f82a33 100644 --- a/fdbserver/workloads/MachineAttrition.actor.cpp +++ b/fdbserver/workloads/MachineAttrition.actor.cpp @@ -112,11 +112,9 @@ struct MachineAttritionWorkload : TestWorkload { return machines; } - virtual std::string description() { return "MachineAttritionWorkload"; } - virtual Future setup( Database const& cx ) { - return Void(); - } - virtual Future start( Database const& cx ) { + std::string description() const override { return "MachineAttritionWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if (enabled) { std::map>,LocalityData> machineIDMap; auto processes = getServers(); @@ -149,9 +147,8 @@ struct MachineAttritionWorkload : TestWorkload { throw please_reboot(); return Void(); } - virtual Future check( Database const& cx ) { return ignoreSSFailures; } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return ignoreSSFailures; } + void getMetrics(vector& m) override {} static bool noSimIsViableKill(WorkerDetails worker) { return (worker.processClass != ProcessClass::ClassType::TesterClass); diff --git a/fdbserver/workloads/Mako.actor.cpp b/fdbserver/workloads/Mako.actor.cpp index d7ab755cc8..a22daa2484 100644 --- a/fdbserver/workloads/Mako.actor.cpp +++ b/fdbserver/workloads/Mako.actor.cpp @@ -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::max(); } + double getCheckTimeout() const override { return std::numeric_limits::max(); } void getMetrics(std::vector& m) override { // metrics of population process diff --git a/fdbserver/workloads/MemoryLifetime.actor.cpp b/fdbserver/workloads/MemoryLifetime.actor.cpp index 29e3d180f0..bbc7abb26e 100644 --- a/fdbserver/workloads/MemoryLifetime.actor.cpp +++ b/fdbserver/workloads/MemoryLifetime.actor.cpp @@ -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 setup( Database const& cx ) { - return _setup(cx, this); - } + Future setup(Database const& cx) override { return _setup(cx, this); } - virtual Future start( Database const& cx ) { - return _start(cx, this); - } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check( Database const& cx ) { - return true; - } - - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} ACTOR Future _setup( Database cx, MemoryLifetime* self) { state Promise loadTime; diff --git a/fdbserver/workloads/MetricLogging.actor.cpp b/fdbserver/workloads/MetricLogging.actor.cpp index 959134999d..28ae7b77e9 100644 --- a/fdbserver/workloads/MetricLogging.actor.cpp +++ b/fdbserver/workloads/MetricLogging.actor.cpp @@ -54,11 +54,9 @@ struct MetricLoggingWorkload : TestWorkload { } } - virtual std::string description() { return "MetricLogging"; } + std::string description() const override { return "MetricLogging"; } - virtual Future setup( Database const& cx ) { - return _setup( this, cx ); - } + Future setup(Database const& cx) override { return _setup(this, cx); } ACTOR Future _setup( MetricLoggingWorkload* self, Database cx ) { wait( delay(2.0) ); @@ -72,18 +70,18 @@ struct MetricLoggingWorkload : TestWorkload { return Void(); } - virtual Future start( Database const& cx ) { + Future 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 check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( changes.getMetric() ); m.push_back( PerfMetric( "Changes/sec", changes.getValue() / testDuration, false ) ); } diff --git a/fdbserver/workloads/ParallelRestore.actor.cpp b/fdbserver/workloads/ParallelRestore.actor.cpp index bd5976dcb7..2b7fbde4bc 100644 --- a/fdbserver/workloads/ParallelRestore.actor.cpp +++ b/fdbserver/workloads/ParallelRestore.actor.cpp @@ -33,11 +33,11 @@ struct RunRestoreWorkerWorkload : TestWorkload { TraceEvent("RunRestoreWorkerWorkloadMX"); } - virtual std::string description() { return "RunRestoreWorkerWorkload"; } + std::string description() const override { return "RunRestoreWorkerWorkload"; } - virtual Future setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future 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 check(Database const& cx) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; WorkloadFactory RunRestoreWorkerWorkloadFactory("RunRestoreWorkerWorkload"); diff --git a/fdbserver/workloads/Performance.actor.cpp b/fdbserver/workloads/Performance.actor.cpp index ffb4f90e07..0c73f1c26c 100644 --- a/fdbserver/workloads/Performance.actor.cpp +++ b/fdbserver/workloads/Performance.actor.cpp @@ -48,24 +48,22 @@ struct PerformanceWorkload : TestWorkload { printf( "saved %d options\n", savedOptions.size() ); } - virtual std::string description() { return "PerformanceTestWorkload"; } - virtual Future setup( Database const& cx ) { + std::string description() const override { return "PerformanceTestWorkload"; } + Future setup(Database const& cx) override { if( !clientId ) return _setup( cx, this ); return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( !clientId ) return _start( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { for(int i=0; i < metrics.size(); i++) m.push_back( metrics[i] ); if( !clientId ) { diff --git a/fdbserver/workloads/Ping.actor.cpp b/fdbserver/workloads/Ping.actor.cpp index 4cc6fd1511..332b605d36 100644 --- a/fdbserver/workloads/Ping.actor.cpp +++ b/fdbserver/workloads/Ping.actor.cpp @@ -70,13 +70,13 @@ struct PingWorkload : TestWorkload { actorCount = getOption( options, LiteralStringRef("actorCount"), 1 ); } - virtual std::string description() { return "PingWorkload"; } - virtual Future setup( Database const& cx ) { + std::string description() const override { return "PingWorkload"; } + Future setup(Database const& cx) override { if (pingWorkers || !registerInterface) return Void(); return persistInterface( this, cx ); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { vector> 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 check( Database const& cx ) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& 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() ); diff --git a/fdbserver/workloads/PopulateTPCC.actor.cpp b/fdbserver/workloads/PopulateTPCC.actor.cpp index 832a2b3408..0e40f926b1 100644 --- a/fdbserver/workloads/PopulateTPCC.actor.cpp +++ b/fdbserver/workloads/PopulateTPCC.actor.cpp @@ -153,7 +153,7 @@ struct PopulateTPCC : TestWorkload { } } - virtual std::string description() override { return DESCRIPTION; } + std::string description() const override { return DESCRIPTION; } ACTOR static Future populateItems(PopulateTPCC* self, Database cx) { state Transaction tr(cx); @@ -507,11 +507,11 @@ struct PopulateTPCC : TestWorkload { return populate(this, cx); } - virtual Future start(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { return Void(); } - virtual Future check(Database const& cx) override { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) override {} + void getMetrics(vector& m) override {} }; } // namespace diff --git a/fdbserver/workloads/PubSubMultiples.actor.cpp b/fdbserver/workloads/PubSubMultiples.actor.cpp index 06b229d274..2eaf783395 100644 --- a/fdbserver/workloads/PubSubMultiples.actor.cpp +++ b/fdbserver/workloads/PubSubMultiples.actor.cpp @@ -41,21 +41,15 @@ struct PubSubMultiplesWorkload : TestWorkload { inboxesPerActor = getOption( options, LiteralStringRef("inboxesPerActor"), 20 ); } - virtual std::string description() { return "PubSubMultiplesWorkload"; } - virtual Future setup( Database const& cx ) { - return createNodes( this, cx ); - } - virtual Future start( Database const& cx ) { + std::string description() const override { return "PubSubMultiplesWorkload"; } + Future setup(Database const& cx) override { return createNodes(this, cx); } + Future start(Database const& cx) override { Future _ = startTests( this, cx ); return delay(testDuration); } - virtual Future check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { - m.push_back( messages.getMetric() ); - } + void getMetrics(vector& 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 ) ); } diff --git a/fdbserver/workloads/QueuePush.actor.cpp b/fdbserver/workloads/QueuePush.actor.cpp index 56c7406c38..f50bce631e 100644 --- a/fdbserver/workloads/QueuePush.actor.cpp +++ b/fdbserver/workloads/QueuePush.actor.cpp @@ -54,12 +54,12 @@ struct QueuePushWorkload : TestWorkload { startingKey = LiteralStringRef("0000000000000001"); } - virtual std::string description() { return "QueuePush"; } - virtual Future start( Database const& cx ) { return _start( cx, this ); } + std::string description() const override { return "QueuePush"; } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check( Database const& cx ) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(std::vector& m ) { + void getMetrics(std::vector& m) override { double duration = testDuration; int writes = transactions.getValue(); m.emplace_back("Measured Duration", duration, true); diff --git a/fdbserver/workloads/RYWDisable.actor.cpp b/fdbserver/workloads/RYWDisable.actor.cpp index d971a4b51d..cbd2703d64 100644 --- a/fdbserver/workloads/RYWDisable.actor.cpp +++ b/fdbserver/workloads/RYWDisable.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return _start( cx, this ); return Void(); @@ -102,7 +100,7 @@ struct RYWDisableWorkload : TestWorkload { } } - virtual Future check( Database const& cx ) { + Future 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& m ) { - } + void getMetrics(vector& m) override {} Key keyForIndex( uint64_t index ) { Key result = makeString( keyBytes ); diff --git a/fdbserver/workloads/RYWPerformance.actor.cpp b/fdbserver/workloads/RYWPerformance.actor.cpp index 99ecdbf038..a12ce98aff 100644 --- a/fdbserver/workloads/RYWPerformance.actor.cpp +++ b/fdbserver/workloads/RYWPerformance.actor.cpp @@ -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 setup( Database const& cx ) { + Future 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 start( Database const& cx ) { + Future 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 check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { - } + void getMetrics(vector& m) override {} Key keyForIndex( uint64_t index ) { Key result = makeString( keyBytes ); diff --git a/fdbserver/workloads/RandomClogging.actor.cpp b/fdbserver/workloads/RandomClogging.actor.cpp index 2293e12fbf..2ee7081eb3 100644 --- a/fdbserver/workloads/RandomClogging.actor.cpp +++ b/fdbserver/workloads/RandomClogging.actor.cpp @@ -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 setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { + if (&g_simulator == g_network) + return "RandomClogging"; + else + return "NoRC"; + } + Future setup(Database const& cx) override { return Void(); } + Future 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 check( Database const& cx ) { - return true; - } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} ACTOR void doClog( ISimulator::ProcessInfo* machine, double t, double delay = 0.0 ) { wait(::delay(delay)); diff --git a/fdbserver/workloads/RandomMoveKeys.actor.cpp b/fdbserver/workloads/RandomMoveKeys.actor.cpp index e5d446c415..4ec4bb1a2d 100644 --- a/fdbserver/workloads/RandomMoveKeys.actor.cpp +++ b/fdbserver/workloads/RandomMoveKeys.actor.cpp @@ -43,11 +43,9 @@ struct MoveKeysWorkload : TestWorkload { maxKeyspace = getOption( options, LiteralStringRef("maxKeyspace"), 0.1 ); } - virtual std::string description() { return "MoveKeysWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + std::string description() const override { return "MoveKeysWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _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 check( Database const& cx ) { return tag(delay(testDuration/2), true); } // Give the database time to recover from our damage - virtual void getMetrics( vector& m ) { - } + double getCheckTimeout() const override { return testDuration / 2 + 1; } + Future check(Database const& cx) override { + return tag(delay(testDuration / 2), true); + } // Give the database time to recover from our damage + void getMetrics(vector& m) override {} KeyRange getRandomKeys() const { double len = deterministicRandom()->random01() * this->maxKeyspace; diff --git a/fdbserver/workloads/RandomSelector.actor.cpp b/fdbserver/workloads/RandomSelector.actor.cpp index 8e0286fa53..ead551089d 100644 --- a/fdbserver/workloads/RandomSelector.actor.cpp +++ b/fdbserver/workloads/RandomSelector.actor.cpp @@ -45,25 +45,23 @@ struct RandomSelectorWorkload : TestWorkload { fail = false; } - virtual std::string description() { return "RandomSelector"; } + std::string description() const override { return "RandomSelector"; } - virtual Future setup( Database const& cx ) { - return randomSelectorSetup( cx->clone(), this ); - } + Future setup(Database const& cx) override { return randomSelectorSetup(cx->clone(), this); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { clients.push_back( timeout( randomSelectorClient( cx->clone(), this), testDuration, Void()) ); return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return !fail; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); } diff --git a/fdbserver/workloads/ReadAfterWrite.actor.cpp b/fdbserver/workloads/ReadAfterWrite.actor.cpp index 5b0d861507..71e59bcfcf 100644 --- a/fdbserver/workloads/ReadAfterWrite.actor.cpp +++ b/fdbserver/workloads/ReadAfterWrite.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } ACTOR static Future benchmark(Database cx, ReadAfterWriteWorkload* self) { loop { @@ -104,16 +104,16 @@ struct ReadAfterWriteWorkload : KVWorkload { } } - virtual Future start(Database const& cx) { return _start(cx, this); } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _start(Database cx, ReadAfterWriteWorkload* self) { state Future lifetime = benchmark(cx, self); wait(delay(self->testDuration)); return Void(); } - virtual Future check(Database const& cx) override { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(std::vector& m) { + void getMetrics(std::vector& 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); diff --git a/fdbserver/workloads/ReadHotDetection.actor.cpp b/fdbserver/workloads/ReadHotDetection.actor.cpp index a198d0d20f..c26ab4438c 100644 --- a/fdbserver/workloads/ReadHotDetection.actor.cpp +++ b/fdbserver/workloads/ReadHotDetection.actor.cpp @@ -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 setup(Database const& cx) { return _setup(cx, this); } + Future setup(Database const& cx) override { return _setup(cx, this); } - virtual Future start(Database const& cx) { + Future 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 check(Database const& cx) { + Future check(Database const& cx) override { if (clientId != 0) return true; return passed; } @@ -129,7 +129,7 @@ struct ReadHotDetectionWorkload : TestWorkload { } } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} ACTOR Future keyReader(Database cx, ReadHotDetectionWorkload* self, double delay, bool useReadKey) { state double lastTime = now(); diff --git a/fdbserver/workloads/ReadWrite.actor.cpp b/fdbserver/workloads/ReadWrite.actor.cpp index 711aef0eca..8b7dd9564c 100644 --- a/fdbserver/workloads/ReadWrite.actor.cpp +++ b/fdbserver/workloads/ReadWrite.actor.cpp @@ -219,9 +219,9 @@ struct ReadWriteWorkload : KVWorkload { } } - virtual std::string description() { return descriptionString.toString(); } - virtual Future setup( Database const& cx ) { return _setup( cx, this ); } - virtual Future start( Database const& cx ) { return _start( cx, this ); } + std::string description() const override { return descriptionString.toString(); } + Future setup(Database const& cx) override { return _setup(cx, this); } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR static Future traceDumpWorkers( Reference> db ) { try { @@ -261,7 +261,7 @@ struct ReadWriteWorkload : KVWorkload { return true; } - virtual void getMetrics(std::vector& m) { + void getMetrics(std::vector& m) override { double duration = metricsDuration; int reads = (aTransactions.getValue() * readsPerTransactionA) + (bTransactions.getValue() * readsPerTransactionB); int writes = (aTransactions.getValue() * writesPerTransactionA) + (bTransactions.getValue() * writesPerTransactionB); diff --git a/fdbserver/workloads/RemoveServersSafely.actor.cpp b/fdbserver/workloads/RemoveServersSafely.actor.cpp index 3536aede85..dd618337c3 100644 --- a/fdbserver/workloads/RemoveServersSafely.actor.cpp +++ b/fdbserver/workloads/RemoveServersSafely.actor.cpp @@ -59,8 +59,8 @@ struct RemoveServersSafelyWorkload : TestWorkload { } } - virtual std::string description() { return "RemoveServersSafelyWorkload"; } - virtual Future setup( Database const& cx ) { + std::string description() const override { return "RemoveServersSafelyWorkload"; } + Future setup(Database const& cx) override { if( !enabled ) return Void(); @@ -128,19 +128,17 @@ struct RemoveServersSafelyWorkload : TestWorkload { return Void(); } - virtual Future start( Database const& cx ) { + Future 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 check( Database const& cx ) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& ) { - } + void getMetrics(vector&) override {} - virtual std::set getNetworks(std::vector const& processes) - { + std::set getNetworks(std::vector const& processes) { std::set 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 getProcesses(std::set const& netAddrs) - { + std::vector getProcesses(std::set const& netAddrs) { std::vector processes; std::set processAddrs; UID functionId = nondeterministicRandom()->randomUniqueID(); @@ -202,8 +199,7 @@ struct RemoveServersSafelyWorkload : TestWorkload { return processes; } - virtual std::vector excludeAddresses(std::set const& procAddrs) - { + std::vector excludeAddresses(std::set const& procAddrs) { // Get the updated list of processes which may have changed due to reboots, deletes, etc std::vector procArray = getProcesses(procAddrs); @@ -219,8 +215,7 @@ struct RemoveServersSafelyWorkload : TestWorkload { return procArray; } - virtual std::vector includeAddresses(std::set const& procAddrs) - { + std::vector includeAddresses(std::set const& procAddrs) { // Get the updated list of processes which may have changed due to reboots, deletes, etc std::vector 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 protectServers(std::set const& killAddrs) - { + std::vector protectServers(std::set const& killAddrs) { std::vector processes; std::set processAddrs; std::vector killableAddrs; @@ -380,8 +374,7 @@ struct RemoveServersSafelyWorkload : TestWorkload { return Void(); } - virtual std::vector killAddresses(std::set const& killAddrs) - { + std::vector killAddresses(std::set const& killAddrs) { UID functionId = nondeterministicRandom()->randomUniqueID(); bool removeViaClear = !BUGGIFY; std::vector killProcArray; diff --git a/fdbserver/workloads/ReportConflictingKeys.actor.cpp b/fdbserver/workloads/ReportConflictingKeys.actor.cpp index ba4b842d67..608c571f4a 100644 --- a/fdbserver/workloads/ReportConflictingKeys.actor.cpp +++ b/fdbserver/workloads/ReportConflictingKeys.actor.cpp @@ -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 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::max(); } + double getCheckTimeout() const override { return std::numeric_limits::max(); } // Copied from tester.actor.cpp, added parameter to determine the key's length Key keyForIndex(int n) { diff --git a/fdbserver/workloads/Rollback.actor.cpp b/fdbserver/workloads/Rollback.actor.cpp index 2f4b7549ae..24f1a8f458 100644 --- a/fdbserver/workloads/Rollback.actor.cpp +++ b/fdbserver/workloads/Rollback.actor.cpp @@ -46,18 +46,17 @@ struct RollbackWorkload : TestWorkload { multiple = getOption( options, LiteralStringRef("multiple"), true ); } - virtual std::string description() { return "RollbackWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "RollbackWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future 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 check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} ACTOR Future simulateFailure( Database cx, RollbackWorkload* self ) { state ServerDBInfo system = self->dbInfo->get(); diff --git a/fdbserver/workloads/RyowCorrectness.actor.cpp b/fdbserver/workloads/RyowCorrectness.actor.cpp index 9771ebc66f..2a3bc3d5bc 100644 --- a/fdbserver/workloads/RyowCorrectness.actor.cpp +++ b/fdbserver/workloads/RyowCorrectness.actor.cpp @@ -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 performSetup(Database cx, RyowCorrectnessWorkload *self) { std::vector types; @@ -353,9 +351,7 @@ struct RyowCorrectnessWorkload : ApiWorkload { return ::success(timeout(performTest(cx, data, this), duration)); } - virtual void getMetrics( vector& m ) { - - } + void getMetrics(vector& m) override {} }; WorkloadFactory RyowCorrectnessWorkloadFactory("RyowCorrectness"); diff --git a/fdbserver/workloads/SaveAndKill.actor.cpp b/fdbserver/workloads/SaveAndKill.actor.cpp index 87faa3a7bc..91911c9695 100644 --- a/fdbserver/workloads/SaveAndKill.actor.cpp +++ b/fdbserver/workloads/SaveAndKill.actor.cpp @@ -44,14 +44,12 @@ struct SaveAndKillWorkload : TestWorkload { isRestoring = getOption( options, LiteralStringRef("isRestoring"), 0 ); } - virtual std::string description() { return "SaveAndKillWorkload"; } - virtual Future setup( Database const& cx ) { + std::string description() const override { return "SaveAndKillWorkload"; } + Future setup(Database const& cx) override { g_simulator.disableSwapsToAll(); return Void(); } - virtual Future start( Database const& cx ) { - return _start(this); - } + Future start(Database const& cx) override { return _start(this); } ACTOR Future _start( SaveAndKillWorkload* self) { state int i; @@ -131,11 +129,8 @@ struct SaveAndKillWorkload : TestWorkload { return Void(); } - virtual Future check( Database const& cx ) { - return true; - } - virtual void getMetrics( std::vector& ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(std::vector&) override {} }; WorkloadFactory SaveAndKillWorkloadFactory("SaveAndKill"); diff --git a/fdbserver/workloads/SelectorCorrectness.actor.cpp b/fdbserver/workloads/SelectorCorrectness.actor.cpp index 5bb08a4a0c..2699a79031 100644 --- a/fdbserver/workloads/SelectorCorrectness.actor.cpp +++ b/fdbserver/workloads/SelectorCorrectness.actor.cpp @@ -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 setup( Database const& cx ) { - return SelectorCorrectnessSetup( cx->clone(), this ); - } + Future setup(Database const& cx) override { return SelectorCorrectnessSetup(cx->clone(), this); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { clients.push_back( timeout( SelectorCorrectnessClient( cx->clone(), this), testDuration, Void()) ); return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); } diff --git a/fdbserver/workloads/Serializability.actor.cpp b/fdbserver/workloads/Serializability.actor.cpp index daf22732a6..d0cc6be768 100644 --- a/fdbserver/workloads/Serializability.actor.cpp +++ b/fdbserver/workloads/Serializability.actor.cpp @@ -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 setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return _start( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics( vector& m ) { - } + void getMetrics(vector& 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< setup( Database const& cx ) { - return persistInterface( this, cx->clone() ); - } - virtual Future start( Database const& cx ) { + std::string description() const override { return "SidebandWorkload"; } + Future setup(Database const& cx) override { return persistInterface(this, cx->clone()); } + Future start(Database const& cx) override { clients.push_back( mutator( this, cx->clone() ) ); clients.push_back( checker( this, cx->clone() ) ); return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { int errors = 0; for(int c=0; c& m ) { + void getMetrics(vector& m) override { m.push_back( messages.getMetric() ); m.push_back( consistencyErrors.getMetric() ); m.push_back( keysUnexpectedlyPresent.getMetric() ); diff --git a/fdbserver/workloads/SimpleAtomicAdd.actor.cpp b/fdbserver/workloads/SimpleAtomicAdd.actor.cpp index 7bdca5d0e2..1ea8738696 100644 --- a/fdbserver/workloads/SimpleAtomicAdd.actor.cpp +++ b/fdbserver/workloads/SimpleAtomicAdd.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId) { return Void(); } return _start(cx, this); } - virtual Future check(Database const& cx) { + Future check(Database const& cx) override { if (clientId) { return true; } @@ -131,7 +131,7 @@ struct SimpleAtomicAddWorkload : TestWorkload { } } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; WorkloadFactory SimpleAtomicAddWorkloadFactory("SimpleAtomicAdd"); diff --git a/fdbserver/workloads/SlowTaskWorkload.actor.cpp b/fdbserver/workloads/SlowTaskWorkload.actor.cpp index 897245f06d..25f50c4767 100644 --- a/fdbserver/workloads/SlowTaskWorkload.actor.cpp +++ b/fdbserver/workloads/SlowTaskWorkload.actor.cpp @@ -31,21 +31,16 @@ struct SlowTaskWorkload : TestWorkload { : TestWorkload(wcx) { } - virtual std::string description() { - return "SlowTaskWorkload"; - } + std::string description() const override { return "SlowTaskWorkload"; } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { setupRunLoopProfiler(); return go(); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future go() { wait( delay(1) ); diff --git a/fdbserver/workloads/SnapTest.actor.cpp b/fdbserver/workloads/SnapTest.actor.cpp index 929c5eabb4..52e72911e3 100644 --- a/fdbserver/workloads/SnapTest.actor.cpp +++ b/fdbserver/workloads/SnapTest.actor.cpp @@ -102,7 +102,7 @@ public: // ctor & dtor } public: // workload functions - std::string description() override { return "SnapTest"; } + std::string description() const override { return "SnapTest"; } Future setup(Database const& cx) override { TraceEvent("SnapTestWorkloadSetup"); return Void(); diff --git a/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp b/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp index ed5d9dfc69..4fb09a1fea 100644 --- a/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp +++ b/fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp @@ -52,14 +52,14 @@ struct SpecialKeySpaceCorrectnessWorkload : TestWorkload { ASSERT(conflictRangeSizeFactor >= 1); } - virtual std::string description() { return "SpecialKeySpaceCorrectness"; } - virtual Future setup(Database const& cx) { return _setup(cx, this); } - virtual Future start(Database const& cx) { return _start(cx, this); } - virtual Future check(Database const& cx) { return wrongResults.getValue() == 0; } - virtual void getMetrics(std::vector& m) {} + std::string description() const override { return "SpecialKeySpaceCorrectness"; } + Future setup(Database const& cx) override { return _setup(cx, this); } + Future start(Database const& cx) override { return _start(cx, this); } + Future check(Database const& cx) override { return wrongResults.getValue() == 0; } + void getMetrics(std::vector& m) override {} // disable the default timeout setting - double getCheckTimeout() override { return std::numeric_limits::max(); } + double getCheckTimeout() const override { return std::numeric_limits::max(); } Future _setup(Database cx, SpecialKeySpaceCorrectnessWorkload* self) { cx->specialKeySpace = std::make_unique(); diff --git a/fdbserver/workloads/StatusWorkload.actor.cpp b/fdbserver/workloads/StatusWorkload.actor.cpp index e9bfa5ab88..97b382ef67 100644 --- a/fdbserver/workloads/StatusWorkload.actor.cpp +++ b/fdbserver/workloads/StatusWorkload.actor.cpp @@ -57,25 +57,23 @@ struct StatusWorkload : TestWorkload { noUnseed = true; } - virtual std::string description() { return "StatusWorkload"; } - virtual Future setup(Database const& cx) { + std::string description() const override { return "StatusWorkload"; } + Future setup(Database const& cx) override { if(enableLatencyBands) { latencyBandActor = configureLatencyBands(this, cx); } return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return success(timeout(fetcher(cx, this), testDuration)); } - virtual Future check(Database const& cx) { - return errors.getValue() == 0; - } + Future check(Database const& cx) override { return errors.getValue() == 0; } - virtual void getMetrics(vector& m) { + void getMetrics(vector& m) override { if (clientId != 0) return; diff --git a/fdbserver/workloads/Storefront.actor.cpp b/fdbserver/workloads/Storefront.actor.cpp index 0e9b9339ac..8c0c7454f5 100644 --- a/fdbserver/workloads/Storefront.actor.cpp +++ b/fdbserver/workloads/Storefront.actor.cpp @@ -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 setup( Database const& cx ) { - return bulkSetup( cx, this, itemCount, Promise() ); - } + Future setup(Database const& cx) override { return bulkSetup(cx, this, itemCount, Promise()); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { for(int c=0; cclone(), this, actorCount / transactionsPerSecond ) ); @@ -70,7 +68,7 @@ struct StorefrontWorkload : TestWorkload { return delay(testDuration); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { int errors = 0; for(int c=0; cclone(), this, !errors ); } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& 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 ) ); diff --git a/fdbserver/workloads/StreamingRead.actor.cpp b/fdbserver/workloads/StreamingRead.actor.cpp index 69a2464afb..cd0dfafdcb 100644 --- a/fdbserver/workloads/StreamingRead.actor.cpp +++ b/fdbserver/workloads/StreamingRead.actor.cpp @@ -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 setup( Database const& cx ) { + Future setup(Database const& cx) override { return bulkSetup( cx, this, nodeCount, Promise(), true, warmingDelay ); } - virtual Future start( Database const& cx ) { + Future 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 check( Database const& cx ) { + Future check(Database const& cx) override { clients.clear(); return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( readKeys.getMetric() ); m.push_back( PerfMetric( "Bytes read/sec", diff --git a/fdbserver/workloads/SuspendProcesses.actor.cpp b/fdbserver/workloads/SuspendProcesses.actor.cpp index df5cdcec3c..936dda8432 100644 --- a/fdbserver/workloads/SuspendProcesses.actor.cpp +++ b/fdbserver/workloads/SuspendProcesses.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } ACTOR Future _start(Database cx, SuspendProcessesWorkload* self) { wait(delay(self->waitTimeDuration)); @@ -59,14 +59,14 @@ struct SuspendProcessesWorkload : TestWorkload { } } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; WorkloadFactory SuspendProcessesWorkloadFactory("SuspendProcesses"); diff --git a/fdbserver/workloads/TPCC.actor.cpp b/fdbserver/workloads/TPCC.actor.cpp index ffd69aa90a..6d55ffa121 100644 --- a/fdbserver/workloads/TPCC.actor.cpp +++ b/fdbserver/workloads/TPCC.actor.cpp @@ -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 start(Database const& cx) override { + Future 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 check(Database const& cx) override { + Future check(Database const& cx) override { return (transactionsPerMinute() > expectedTransactionsPerMinute); } - virtual void getMetrics(vector& m) override { + void getMetrics(vector& m) override { double multiplier = static_cast(clientCount) / static_cast(clientsUsed); m.push_back(PerfMetric("Transactions Per Minute", transactionsPerMinute(), false)); diff --git a/fdbserver/workloads/TagThrottleApi.actor.cpp b/fdbserver/workloads/TagThrottleApi.actor.cpp index fec3d18735..273ef8e7f9 100644 --- a/fdbserver/workloads/TagThrottleApi.actor.cpp +++ b/fdbserver/workloads/TagThrottleApi.actor.cpp @@ -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 setup(Database const& cx) { + Future setup(Database const& cx) override { DatabaseContext::debugUseTags = true; return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (this->clientId != 0) return Void(); return timeout(runThrottleApi(this, cx), testDuration, Void()); } - virtual Future check(Database const& cx) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} static Optional randomTagThrottleType() { Optional throttleType; diff --git a/fdbserver/workloads/TargetedKill.actor.cpp b/fdbserver/workloads/TargetedKill.actor.cpp index f067ae229d..1cd822c725 100644 --- a/fdbserver/workloads/TargetedKill.actor.cpp +++ b/fdbserver/workloads/TargetedKill.actor.cpp @@ -43,17 +43,16 @@ struct TargetedKillWorkload : TestWorkload { killAllMachineProcesses = getOption( options, LiteralStringRef("killWholeMachine"), false ); } - virtual std::string description() { return "TargetedKillWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "TargetedKillWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { TraceEvent("StartTargetedKill").detail("Enabled", enabled); if (enabled) return assassin( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) { - } + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} ACTOR Future killEndpoint( NetworkAddress address, Database cx, TargetedKillWorkload* self ) { if( &g_simulator == g_network ) { diff --git a/fdbserver/workloads/TaskBucketCorrectness.actor.cpp b/fdbserver/workloads/TaskBucketCorrectness.actor.cpp index 32401435bf..41fc658d29 100644 --- a/fdbserver/workloads/TaskBucketCorrectness.actor.cpp +++ b/fdbserver/workloads/TaskBucketCorrectness.actor.cpp @@ -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 start(Database const& cx) { - return _start(cx, this); - } + Future start(Database const& cx) override { return _start(cx, this); } - virtual Future check(Database const& cx) { - return _check(cx, this); - } + Future check(Database const& cx) override { return _check(cx, this); } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR Future addInitTasks(Reference tr, Reference taskBucket, Reference futureBucket, bool chained, int subtaskCount) { state Key addedInitKey(LiteralStringRef("addedInitTasks")); diff --git a/fdbserver/workloads/ThreadSafety.actor.cpp b/fdbserver/workloads/ThreadSafety.actor.cpp index 3c56790c32..067b3074e5 100644 --- a/fdbserver/workloads/ThreadSafety.actor.cpp +++ b/fdbserver/workloads/ThreadSafety.actor.cpp @@ -139,17 +139,11 @@ struct ThreadSafetyWorkload : TestWorkload { noUnseed = true; } - virtual std::string description() { - return "ThreadSafety"; - } + std::string description() const override { return "ThreadSafety"; } - virtual Future setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { - return _start(cx, this); - } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR Future _start(Database cx, ThreadSafetyWorkload *self) { state std::vector threadInfo; @@ -293,13 +287,9 @@ struct ThreadSafetyWorkload : TestWorkload { } } - virtual Future check(Database const& cx) { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics(vector& m) { - - } + void getMetrics(vector& m) override {} }; WorkloadFactory ThreadSafetyWorkloadFactory("ThreadSafety"); diff --git a/fdbserver/workloads/Throttling.actor.cpp b/fdbserver/workloads/Throttling.actor.cpp index e5f8940577..6df3f6bc69 100644 --- a/fdbserver/workloads/Throttling.actor.cpp +++ b/fdbserver/workloads/Throttling.actor.cpp @@ -192,13 +192,11 @@ struct ThrottlingWorkload : KVWorkload { return Void(); } - virtual std::string description() { return ThrottlingWorkload::NAME; } - virtual Future start(Database const& cx) { return _start(cx, this); } - virtual Future check(Database const& cx) { - return correctSpecialKeys; - } + std::string description() const override { return ThrottlingWorkload::NAME; } + Future start(Database const& cx) override { return _start(cx, this); } + Future check(Database const& cx) override { return correctSpecialKeys; } - virtual void getMetrics(vector& m) { + void getMetrics(vector& m) override { m.push_back(PerfMetric("TransactionsCommitted", transactionsCommitted, false)); } }; diff --git a/fdbserver/workloads/Throughput.actor.cpp b/fdbserver/workloads/Throughput.actor.cpp index 423b614030..0f8ccf3b99 100644 --- a/fdbserver/workloads/Throughput.actor.cpp +++ b/fdbserver/workloads/Throughput.actor.cpp @@ -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 setup( Database const& cx ) { + Future setup(Database const& cx) override { return Void(); // No setup for now - use a separate workload to do setup } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { startT = now(); PromiseStream> add; Future ac = actorCollection( add.getFuture(), &activeActors ); @@ -351,7 +351,7 @@ struct ThroughputWorkload : TestWorkload { return r; } - virtual Future check( Database const& cx ) { return true; } + Future check(Database const& cx) override { return true; } ACTOR static Future throughputActor( Database db, ThroughputWorkload* self, PromiseStream> add ) { state double before = now(); @@ -388,8 +388,6 @@ struct ThroughputWorkload : TestWorkload { return Void(); } - virtual void getMetrics( vector& m ) { - measurer->getMetrics(m); - } + void getMetrics(vector& m) override { measurer->getMetrics(m); } }; WorkloadFactory ThroughputWorkloadFactory("Throughput"); diff --git a/fdbserver/workloads/TimeKeeperCorrectness.actor.cpp b/fdbserver/workloads/TimeKeeperCorrectness.actor.cpp index 0cf7543110..8e60320bd0 100644 --- a/fdbserver/workloads/TimeKeeperCorrectness.actor.cpp +++ b/fdbserver/workloads/TimeKeeperCorrectness.actor.cpp @@ -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 setup(Database const& cx) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual void getMetrics(vector& m) { - } + void getMetrics(vector& m) override {} ACTOR static Future _start(Database cx, TimeKeeperCorrectnessWorkload *self) { TraceEvent(SevInfo, "TKCorrectness_Start"); @@ -69,9 +64,7 @@ struct TimeKeeperCorrectnessWorkload : TestWorkload { return Void(); } - virtual Future start( Database const& cx ) { - return _start(cx, this); - } + Future start(Database const& cx) override { return _start(cx, this); } ACTOR static Future _check(Database cx, TimeKeeperCorrectnessWorkload *self) { state KeyBackedMap dbTimeKeeper = KeyBackedMap(timeKeeperPrefixRange.begin); @@ -126,9 +119,7 @@ struct TimeKeeperCorrectnessWorkload : TestWorkload { } } - virtual Future check( Database const& cx ) { - return _check(cx, this); - } + Future check(Database const& cx) override { return _check(cx, this); } }; WorkloadFactory TimeKeeperCorrectnessWorkloadFactory("TimeKeeperCorrectness"); diff --git a/fdbserver/workloads/TriggerRecovery.actor.cpp b/fdbserver/workloads/TriggerRecovery.actor.cpp index 976a6c2987..e22652317a 100644 --- a/fdbserver/workloads/TriggerRecovery.actor.cpp +++ b/fdbserver/workloads/TriggerRecovery.actor.cpp @@ -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 setOriginalNumOfResolvers(Database cx, TriggerRecoveryLoopWorkload* self) { DatabaseConfiguration config = wait(getDatabaseConfiguration(cx)); @@ -34,7 +34,7 @@ struct TriggerRecoveryLoopWorkload : TestWorkload { return Void(); } - virtual Future setup(Database const& cx) { + Future setup(Database const& cx) override { if (clientId == 0) { return setOriginalNumOfResolvers(cx, this); } @@ -142,14 +142,14 @@ struct TriggerRecoveryLoopWorkload : TestWorkload { return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if (clientId != 0) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { return true; } + Future check(Database const& cx) override { return true; } - virtual void getMetrics(vector& m) {} + void getMetrics(vector& m) override {} }; WorkloadFactory TriggerRecoveryLoopWorkloadFactory("TriggerRecoveryLoop"); diff --git a/fdbserver/workloads/UnitPerf.actor.cpp b/fdbserver/workloads/UnitPerf.actor.cpp index c0243dc958..ac94cfb6e5 100644 --- a/fdbserver/workloads/UnitPerf.actor.cpp +++ b/fdbserver/workloads/UnitPerf.actor.cpp @@ -56,15 +56,15 @@ struct UnitPerfWorkload : TestWorkload { enabled = !clientId; // only do this on the "first" client } - virtual std::string description() { return "UnitPerfWorkload"; } - virtual Future setup( Database const& cx ) { return Void(); } - virtual Future start( Database const& cx ) { + std::string description() const override { return "UnitPerfWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if (enabled) return unitPerfTest(); return Void(); } - virtual Future check( Database const& cx ) { return true; } - virtual void getMetrics( vector& m ) {} + Future check(Database const& cx) override { return true; } + void getMetrics(vector& m) override {} }; WorkloadFactory UnitPerfWorkloadFactory("UnitPerf"); diff --git a/fdbserver/workloads/UnitTests.actor.cpp b/fdbserver/workloads/UnitTests.actor.cpp index 522a20f073..10fa028354 100644 --- a/fdbserver/workloads/UnitTests.actor.cpp +++ b/fdbserver/workloads/UnitTests.actor.cpp @@ -51,15 +51,15 @@ struct UnitTestWorkload : TestWorkload { forceLinkMemcpyPerfTests(); } - virtual std::string description() { return "UnitTests"; } - virtual Future setup(Database const& cx) { return Void(); } - virtual Future start(Database const& cx) { + std::string description() const override { return "UnitTests"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { if (enabled) return runUnitTests(this); return Void(); } - virtual Future check(Database const& cx) { return testsFailed.getValue() == 0; } - virtual void getMetrics(vector& m) { + Future check(Database const& cx) override { return testsFailed.getValue() == 0; } + void getMetrics(vector& m) override { m.push_back(testsAvailable.getMetric()); m.push_back(testsExecuted.getMetric()); m.push_back(testsFailed.getMetric()); diff --git a/fdbserver/workloads/Unreadable.actor.cpp b/fdbserver/workloads/Unreadable.actor.cpp index 68c6d6787a..4f8f974e79 100644 --- a/fdbserver/workloads/Unreadable.actor.cpp +++ b/fdbserver/workloads/Unreadable.actor.cpp @@ -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 setup( Database const& cx ) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if (clientId == 0) return _start( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { - } + void getMetrics(vector& m) override {} static Optional containsUnreadable(KeyRangeMap & unreadableMap, KeyRangeRef const& range, bool forward) { auto unreadableRanges = unreadableMap.intersectingRanges(range); diff --git a/fdbserver/workloads/VersionStamp.actor.cpp b/fdbserver/workloads/VersionStamp.actor.cpp index 10f1b1879d..100401f3e8 100644 --- a/fdbserver/workloads/VersionStamp.actor.cpp +++ b/fdbserver/workloads/VersionStamp.actor.cpp @@ -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 setup(Database const& cx) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start(Database const& cx) { + Future 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 check(Database const& cx) { + Future 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& m) {} + void getMetrics(vector& m) override {} ACTOR Future _start(Database cx, VersionStampWorkload* self, double delay) { state double startTime = now(); diff --git a/fdbserver/workloads/WatchAndWait.actor.cpp b/fdbserver/workloads/WatchAndWait.actor.cpp index e9a0dbcfd0..dafe02896d 100644 --- a/fdbserver/workloads/WatchAndWait.actor.cpp +++ b/fdbserver/workloads/WatchAndWait.actor.cpp @@ -57,15 +57,13 @@ struct WatchAndWaitWorkload : TestWorkload { } } - virtual std::string description() { return "WatchAndWait"; } + std::string description() const override { return "WatchAndWait"; } - virtual Future setup( Database const& cx ) { return Void(); } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { - return _start( cx, this ); - } + Future start(Database const& cx) override { return _start(cx, this); } - Key keyForIndex( uint64_t index ) { + Key keyForIndex(uint64_t index) const { Key result = makeString( keyBytes ); uint8_t* data = mutateString( result ); memset(data, '.', keyBytes); @@ -82,11 +80,9 @@ struct WatchAndWaitWorkload : TestWorkload { return result; } - virtual Future check( Database const& cx ) { - return true; - } + Future check(Database const& cx) override { return true; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { double duration = testDuration; m.push_back( PerfMetric( "Triggers/sec", triggers.getValue() / duration, false ) ); m.push_back( triggers.getMetric() ); diff --git a/fdbserver/workloads/Watches.actor.cpp b/fdbserver/workloads/Watches.actor.cpp index 966f1ffd99..5df698988e 100644 --- a/fdbserver/workloads/Watches.actor.cpp +++ b/fdbserver/workloads/Watches.actor.cpp @@ -49,19 +49,17 @@ struct WatchesWorkload : TestWorkload { tempRand.randomShuffle( nodeOrder ); } - virtual std::string description() { return "Watches"; } + std::string description() const override { return "Watches"; } - virtual Future setup( Database const& cx ) { - return _setup(cx, this); - } + Future setup(Database const& cx) override { return _setup(cx, this); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return watchesWorker( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { + Future check(Database const& cx) override { bool ok = true; for( int i = 0; i < clients.size(); i++ ) if( clients[i].isError() ) @@ -70,7 +68,7 @@ struct WatchesWorkload : TestWorkload { return ok; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { if( clientId == 0 ) { m.push_back( cycles.getMetric() ); m.push_back( PerfMetric( "Mean Latency (ms)", 1000 * cycleLatencies.mean() / nodes, true ) ); diff --git a/fdbserver/workloads/WorkerErrors.actor.cpp b/fdbserver/workloads/WorkerErrors.actor.cpp index c4cc4a5b51..3f71f140c6 100644 --- a/fdbserver/workloads/WorkerErrors.actor.cpp +++ b/fdbserver/workloads/WorkerErrors.actor.cpp @@ -32,15 +32,10 @@ struct WorkerErrorsWorkload : TestWorkload { WorkerErrorsWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {} - virtual std::string description() { return "WorkerErrorsWorkload"; } - virtual Future setup( Database const& cx ) { - return Void(); - } - virtual Future start( Database const& cx ) { - return _start(cx, this); - } - virtual void getMetrics( vector& m ) {} - + std::string description() const override { return "WorkerErrorsWorkload"; } + Future setup(Database const& cx) override { return Void(); } + Future start(Database const& cx) override { return _start(cx, this); } + void getMetrics(vector& m) override {} ACTOR Future< std::vector< TraceEventFields > > latestEventOnWorkers( std::vector workers ) { state vector> eventTraces; @@ -67,7 +62,7 @@ struct WorkerErrorsWorkload : TestWorkload { return Void(); } - virtual Future check( Database const& cx ) { return true; } + Future check(Database const& cx) override { return true; } }; WorkloadFactory WorkerErrorsWorkloadFactory("WorkerErrors"); diff --git a/fdbserver/workloads/WriteBandwidth.actor.cpp b/fdbserver/workloads/WriteBandwidth.actor.cpp index 890de2763c..c1b189ebb1 100644 --- a/fdbserver/workloads/WriteBandwidth.actor.cpp +++ b/fdbserver/workloads/WriteBandwidth.actor.cpp @@ -49,14 +49,14 @@ struct WriteBandwidthWorkload : KVWorkload { warmingDelay = getOption( options, LiteralStringRef("warmingDelay"), 0.0 ); maxInsertRate = getOption( options, LiteralStringRef("maxInsertRate"), 1e12 ); } - - virtual std::string description() { return "WriteBandwidth"; } - virtual Future setup( Database const& cx ) { return _setup( cx, this ); } - virtual Future start( Database const& cx ) { return _start( cx, this ); } - virtual Future check( Database const& cx ) { return true; } + std::string description() const override { return "WriteBandwidth"; } + Future setup(Database const& cx) override { return _setup(cx, this); } + Future start(Database const& cx) override { return _start(cx, this); } - virtual void getMetrics( std::vector& m ) { + Future check(Database const& cx) override { return true; } + + void getMetrics(std::vector& m) override { double duration = testDuration; int writes = transactions.getValue() * keysPerTransaction; m.emplace_back("Measured Duration", duration, true); diff --git a/fdbserver/workloads/WriteDuringRead.actor.cpp b/fdbserver/workloads/WriteDuringRead.actor.cpp index 1fd9bf4bc5..7459fcca02 100644 --- a/fdbserver/workloads/WriteDuringRead.actor.cpp +++ b/fdbserver/workloads/WriteDuringRead.actor.cpp @@ -93,28 +93,24 @@ struct WriteDuringReadWorkload : TestWorkload { TraceEvent("RYWConfiguration").detail("Nodes", nodes).detail("InitialKeyDensity", initialKeyDensity).detail("AdjacentKeys", adjacentKeys).detail("ValueSizeMin", valueSizeRange.first).detail("ValueSizeMax", valueSizeRange.second).detail("MaxClearSize", maxClearSize); } - virtual std::string description() { return "WriteDuringRead"; } + std::string description() const override { return "WriteDuringRead"; } - virtual Future setup( Database const& cx ) { - return Void(); - } + Future setup(Database const& cx) override { return Void(); } - virtual Future start( Database const& cx ) { + Future start(Database const& cx) override { if( clientId == 0 ) return loadAndRun( cx, this ); return Void(); } - virtual Future check( Database const& cx ) { - return success; - } + Future check(Database const& cx) override { return success; } - virtual void getMetrics( vector& m ) { + void getMetrics(vector& m) override { m.push_back( transactions.getMetric() ); m.push_back( retries.getMetric() ); } - Key memoryGetKey( std::map *db, KeySelector key ) { + Key memoryGetKey(std::map* db, KeySelector key) const { std::map::iterator iter; if( key.orEqual ) iter = db->upper_bound( key.getKey() ); diff --git a/fdbserver/workloads/WriteTagThrottling.actor.cpp b/fdbserver/workloads/WriteTagThrottling.actor.cpp index 30a917a549..f347d5ba30 100644 --- a/fdbserver/workloads/WriteTagThrottling.actor.cpp +++ b/fdbserver/workloads/WriteTagThrottling.actor.cpp @@ -90,7 +90,7 @@ struct WriteTagThrottlingWorkload : KVWorkload { goodTag = TransactionTag(std::string("gT")); } - virtual std::string description() { return WriteTagThrottlingWorkload::NAME; } + std::string description() const override { return WriteTagThrottlingWorkload::NAME; } ACTOR static Future _setup(Database cx, WriteTagThrottlingWorkload* self) { ASSERT(CLIENT_KNOBS->MAX_TAGS_PER_TRANSACTION >= MIN_TAGS_PER_TRANSACTION && @@ -124,11 +124,11 @@ struct WriteTagThrottlingWorkload : KVWorkload { wait(timeout(waitForAll(clientActors), self->testDuration, Void())); return Void(); } - virtual Future start(Database const& cx) { + Future start(Database const& cx) override { if(fastSuccess) return Void(); return _start(cx, this); } - virtual Future check(Database const& cx) { + Future check(Database const& cx) override { if(fastSuccess) return true; if (writeThrottle) { if (!badActorThrottleRetries && !goodActorThrottleRetries) { @@ -149,7 +149,7 @@ struct WriteTagThrottlingWorkload : KVWorkload { } return true; } - virtual void getMetrics(vector& m) { + void getMetrics(vector& m) override { m.push_back(PerfMetric("Transactions (badActor)", badActorTrNum, false)); m.push_back(PerfMetric("Transactions (goodActor)", goodActorTrNum, false)); m.push_back(PerfMetric("Avg Latency (ms, badActor)", 1000 * badActorTotalLatency / badActorTrNum, true)); diff --git a/fdbserver/workloads/workloads.actor.h b/fdbserver/workloads/workloads.actor.h index 8f42f35e16..a363fbd384 100644 --- a/fdbserver/workloads/workloads.actor.h +++ b/fdbserver/workloads/workloads.actor.h @@ -68,13 +68,13 @@ struct TestWorkload : NonCopyable, WorkloadContext { phases |= TestWorkload::SETUP; } virtual ~TestWorkload() {}; - virtual std::string description() = 0; + virtual std::string description() const = 0; virtual Future setup( Database const& cx ) { return Void(); } virtual Future start( Database const& cx ) = 0; virtual Future check( Database const& cx ) = 0; virtual void getMetrics( vector& m ) = 0; - virtual double getCheckTimeout() { return 3000; } + virtual double getCheckTimeout() const { return 3000; } enum WorkloadPhase { SETUP = 1, @@ -103,11 +103,11 @@ struct KVWorkload : TestWorkload { absentFrac = getOption( options, LiteralStringRef("absentFrac"), 0.0); } - Key getRandomKey(); - Key getRandomKey( double absentFrac ); - Key getRandomKey( bool absent ); - Key keyForIndex( uint64_t index ); - Key keyForIndex( uint64_t index, bool absent ); + Key getRandomKey() const; + Key getRandomKey(double absentFrac) const; + Key getRandomKey(bool absent) const; + Key keyForIndex(uint64_t index) const; + Key keyForIndex(uint64_t index, bool absent) const; }; struct IWorkloadFactory {