Rename high contention allocator implementation in fdbclient
This commit is contained in:
parent
027fe80594
commit
6affc58e97
|
@ -62,7 +62,7 @@ set(FDBCLIENT_SRCS
|
|||
GlobalConfig.actor.h
|
||||
GlobalConfig.actor.cpp
|
||||
GrvProxyInterface.h
|
||||
HighContentionAllocator.actor.h
|
||||
HighContentionPrefixAllocator.actor.h
|
||||
HTTP.actor.cpp
|
||||
IClientApi.h
|
||||
IConfigTransaction.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* HighContentionAllocator.actor.h
|
||||
* HighContentionPrefixAllocator.actor.h
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
|
@ -22,11 +22,11 @@
|
|||
|
||||
// When actually compiled (NO_INTELLISENSE), include the generated version of this file. In intellisense use the source
|
||||
// version.
|
||||
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_HIGHCONTENTIONALLOCATOR_ACTOR_G_H)
|
||||
#define FDBCLIENT_HIGHCONTENTIONALLOCATOR_ACTOR_G_H
|
||||
#include "fdbclient/HighContentionAllocator.actor.g.h"
|
||||
#elif !defined(FDBCLIENT_HIGHCONTENTIONALLOCATOR_ACTOR_H)
|
||||
#define FDBCLIENT_HIGHCONTENTIONALLOCATOR_ACTOR_H
|
||||
#if defined(NO_INTELLISENSE) && !defined(FDBCLIENT_HIGHCONTENTIONPREFIXALLOCATOR_ACTOR_G_H)
|
||||
#define FDBCLIENT_HIGHCONTENTIONPREFIXALLOCATOR_ACTOR_G_H
|
||||
#include "fdbclient/HighContentionPrefixAllocator.actor.g.h"
|
||||
#elif !defined(FDBCLIENT_HIGHCONTENTIONPREFIXALLOCATOR_ACTOR_H)
|
||||
#define FDBCLIENT_HIGHCONTENTIONPREFIXALLOCATOR_ACTOR_H
|
||||
|
||||
#include "fdbclient/ClientBooleanParams.h"
|
||||
#include "fdbclient/CommitTransaction.h"
|
||||
|
@ -35,9 +35,9 @@
|
|||
#include "flow/UnitTest.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
class HighContentionAllocator {
|
||||
class HighContentionPrefixAllocator {
|
||||
public:
|
||||
HighContentionAllocator(Subspace subspace) : counters(subspace.get(0)), recent(subspace.get(1)) {}
|
||||
HighContentionPrefixAllocator(Subspace subspace) : counters(subspace.get(0)), recent(subspace.get(1)) {}
|
||||
|
||||
template <class TransactionT>
|
||||
Future<Standalone<StringRef>> allocate(Reference<TransactionT> tr) {
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
Subspace recent;
|
||||
|
||||
ACTOR template <class TransactionT>
|
||||
Future<Standalone<StringRef>> allocate(HighContentionAllocator* self, Reference<TransactionT> tr) {
|
||||
Future<Standalone<StringRef>> allocate(HighContentionPrefixAllocator* self, Reference<TransactionT> tr) {
|
||||
state int64_t start = 0;
|
||||
state int64_t window = 0;
|
||||
|
||||
|
@ -97,7 +97,7 @@ private:
|
|||
count = *(int64_t*)countValue.get().begin();
|
||||
}
|
||||
|
||||
window = HighContentionAllocator::windowSize(start);
|
||||
window = HighContentionPrefixAllocator::windowSize(start);
|
||||
if (count * 2 < window) {
|
||||
break;
|
||||
}
|
|
@ -197,7 +197,7 @@ set(FDBSERVER_SRCS
|
|||
workloads/FuzzApiCorrectness.actor.cpp
|
||||
workloads/GetRangeStream.actor.cpp
|
||||
workloads/HealthMetricsApi.actor.cpp
|
||||
workloads/HighContentionAllocatorWorkload.actor.cpp
|
||||
workloads/HighContentionPrefixAllocatorWorkload.actor.cpp
|
||||
workloads/IncrementalBackup.actor.cpp
|
||||
workloads/Increment.actor.cpp
|
||||
workloads/IndexScan.actor.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* HighContentionAllocatorWorkload.actor.cpp
|
||||
* HighContentionPrefixAllocatorWorkload.actor.cpp
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
|
@ -18,17 +18,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "fdbclient/HighContentionAllocator.actor.h"
|
||||
#include "fdbclient/HighContentionPrefixAllocator.actor.h"
|
||||
#include "fdbserver/TesterInterface.actor.h"
|
||||
#include "fdbserver/workloads/workloads.actor.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
// This workload tests the basic contract of the high contention allocator
|
||||
struct HighContentionAllocatorWorkload : TestWorkload {
|
||||
static constexpr const char* NAME = "HighContentionAllocator";
|
||||
struct HighContentionPrefixAllocatorWorkload : TestWorkload {
|
||||
static constexpr const char* NAME = "HighContentionPrefixAllocator";
|
||||
|
||||
Subspace allocatorSubspace;
|
||||
HighContentionAllocator allocator;
|
||||
HighContentionPrefixAllocator allocator;
|
||||
int numRounds;
|
||||
int maxTransactionsPerRound;
|
||||
int maxAllocationsPerTransaction;
|
||||
|
@ -36,18 +36,18 @@ struct HighContentionAllocatorWorkload : TestWorkload {
|
|||
int expectedPrefixes = 0;
|
||||
std::set<Key> allocatedPrefixes;
|
||||
|
||||
HighContentionAllocatorWorkload(WorkloadContext const& wcx)
|
||||
HighContentionPrefixAllocatorWorkload(WorkloadContext const& wcx)
|
||||
: TestWorkload(wcx), allocatorSubspace("test_subspace"_sr), allocator(allocatorSubspace) {
|
||||
numRounds = getOption(options, LiteralStringRef("numRounds"), 500);
|
||||
maxTransactionsPerRound = getOption(options, LiteralStringRef("maxTransactionsPerRound"), 20);
|
||||
maxAllocationsPerTransaction = getOption(options, LiteralStringRef("maxAllocationsPerTransaction"), 20);
|
||||
}
|
||||
|
||||
std::string description() const override { return HighContentionAllocatorWorkload::NAME; }
|
||||
std::string description() const override { return HighContentionPrefixAllocatorWorkload::NAME; }
|
||||
|
||||
Future<Void> setup(Database const& cx) override { return Void(); }
|
||||
|
||||
ACTOR static Future<Void> runAllocationTransaction(Database cx, HighContentionAllocatorWorkload* self) {
|
||||
ACTOR static Future<Void> runAllocationTransaction(Database cx, HighContentionPrefixAllocatorWorkload* self) {
|
||||
state Reference<ReadYourWritesTransaction> tr = cx->createTransaction();
|
||||
|
||||
state int numAllocations = deterministicRandom()->randomInt(1, self->maxAllocationsPerTransaction + 1);
|
||||
|
@ -104,7 +104,7 @@ struct HighContentionAllocatorWorkload : TestWorkload {
|
|||
return Void();
|
||||
}
|
||||
|
||||
ACTOR static Future<Void> runTest(Database cx, HighContentionAllocatorWorkload* self) {
|
||||
ACTOR static Future<Void> runTest(Database cx, HighContentionPrefixAllocatorWorkload* self) {
|
||||
state int roundNum = 0;
|
||||
for (; roundNum < self->numRounds; ++roundNum) {
|
||||
std::vector<Future<Void>> futures;
|
||||
|
@ -121,7 +121,7 @@ struct HighContentionAllocatorWorkload : TestWorkload {
|
|||
|
||||
Future<Void> start(Database const& cx) override { return runTest(cx, this); }
|
||||
|
||||
ACTOR static Future<bool> _check(Database cx, HighContentionAllocatorWorkload* self) {
|
||||
ACTOR static Future<bool> _check(Database cx, HighContentionPrefixAllocatorWorkload* self) {
|
||||
if (self->expectedPrefixes != self->allocatedPrefixes.size()) {
|
||||
TraceEvent(SevError, "HighContentionAllocationWorkloadFailure")
|
||||
.detail("Reason", "Incorrect Number of Prefixes Allocated")
|
||||
|
@ -156,4 +156,4 @@ struct HighContentionAllocatorWorkload : TestWorkload {
|
|||
|
||||
void getMetrics(std::vector<PerfMetric>& m) override {}
|
||||
};
|
||||
WorkloadFactory<HighContentionAllocatorWorkload> HighContentionAllocatorWorkload(HighContentionAllocatorWorkload::NAME);
|
||||
WorkloadFactory<HighContentionPrefixAllocatorWorkload> HighContentionPrefixAllocatorWorkload(HighContentionPrefixAllocatorWorkload::NAME);
|
|
@ -186,7 +186,7 @@ if(WITH_PYTHON)
|
|||
add_fdb_test(TEST_FILES rare/CycleRollbackClogged.toml)
|
||||
add_fdb_test(TEST_FILES rare/CycleWithKills.toml)
|
||||
add_fdb_test(TEST_FILES rare/FuzzTest.toml)
|
||||
add_fdb_test(TEST_FILES rare/HighContentionAllocator.toml)
|
||||
add_fdb_test(TEST_FILES rare/HighContentionPrefixAllocator.toml)
|
||||
add_fdb_test(TEST_FILES rare/InventoryTestHeavyWrites.toml)
|
||||
add_fdb_test(TEST_FILES rare/LargeApiCorrectness.toml)
|
||||
add_fdb_test(TEST_FILES rare/LargeApiCorrectnessStatus.toml)
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[[test]]
|
||||
testTitle = 'HighContentionAllocator'
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'HighContentionAllocator'
|
|
@ -0,0 +1,5 @@
|
|||
[[test]]
|
||||
testTitle = 'HighContentionPrefixAllocator'
|
||||
|
||||
[[test.workload]]
|
||||
testName = 'HighContentionPrefixAllocator'
|
Loading…
Reference in New Issue