Fix Bulk Load With Tenants Workload (#8754)

* fix bulk load

* Trigger Build
This commit is contained in:
Nim Wijetunga 2022-11-09 13:18:34 -08:00 committed by GitHub
parent 58ebe486f4
commit f1ef9d2671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 24 deletions

View File

@ -33,8 +33,8 @@ struct BulkSetupWorkload : TestWorkload {
int nodeCount; int nodeCount;
double transactionsPerSecond; double transactionsPerSecond;
Key keyPrefix; Key keyPrefix;
double maxNumTenantsPerClient; double maxNumTenants;
double minNumTenantsPerClient; double minNumTenants;
std::vector<TenantName> tenantNames; std::vector<TenantName> tenantNames;
BulkSetupWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) { BulkSetupWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {
@ -42,9 +42,9 @@ struct BulkSetupWorkload : TestWorkload {
nodeCount = getOption(options, "nodeCount"_sr, transactionsPerSecond * clientCount); nodeCount = getOption(options, "nodeCount"_sr, transactionsPerSecond * clientCount);
keyPrefix = unprintable(getOption(options, "keyPrefix"_sr, ""_sr).toString()); keyPrefix = unprintable(getOption(options, "keyPrefix"_sr, ""_sr).toString());
// maximum and minimum number of tenants per client // maximum and minimum number of tenants per client
maxNumTenantsPerClient = getOption(options, "maxNumTenantsPerClient"_sr, 0); maxNumTenants = getOption(options, "maxNumTenants"_sr, 0);
minNumTenantsPerClient = getOption(options, "minNumTenantsPerClient"_sr, 0); minNumTenants = getOption(options, "minNumTenants"_sr, 0);
ASSERT(minNumTenantsPerClient <= maxNumTenantsPerClient); ASSERT(minNumTenants <= maxNumTenants);
} }
void getMetrics(std::vector<PerfMetric>& m) override {} void getMetrics(std::vector<PerfMetric>& m) override {}
@ -58,14 +58,14 @@ struct BulkSetupWorkload : TestWorkload {
ACTOR static Future<Void> _setup(BulkSetupWorkload* workload, Database cx) { ACTOR static Future<Void> _setup(BulkSetupWorkload* workload, Database cx) {
// create a bunch of tenants (between min and max tenants) // create a bunch of tenants (between min and max tenants)
state int numTenantsToCreate = state int numTenantsToCreate =
deterministicRandom()->randomInt(workload->minNumTenantsPerClient, workload->maxNumTenantsPerClient + 1); deterministicRandom()->randomInt(workload->minNumTenants, workload->maxNumTenants + 1);
TraceEvent("BulkSetupTenantCreation").detail("NumTenants", numTenantsToCreate); TraceEvent("BulkSetupTenantCreation").detail("NumTenants", numTenantsToCreate);
if (numTenantsToCreate > 0) { if (numTenantsToCreate > 0) {
std::vector<Future<Void>> tenantFutures; std::vector<Future<Void>> tenantFutures;
for (int i = 0; i < numTenantsToCreate; i++) { for (int i = 0; i < numTenantsToCreate; i++) {
TenantMapEntry entry; TenantMapEntry entry;
entry.encrypted = SERVER_KNOBS->ENABLE_ENCRYPTION; entry.encrypted = SERVER_KNOBS->ENABLE_ENCRYPTION;
workload->tenantNames.push_back(TenantName(format("BulkSetupTenant_%04d_%04d", workload->clientId, i))); workload->tenantNames.push_back(TenantName(format("BulkSetupTenant_%04d", i)));
TraceEvent("CreatingTenant") TraceEvent("CreatingTenant")
.detail("Tenant", workload->tenantNames.back()) .detail("Tenant", workload->tenantNames.back())
.detail("TenantGroup", entry.tenantGroup); .detail("TenantGroup", entry.tenantGroup);
@ -78,6 +78,7 @@ struct BulkSetupWorkload : TestWorkload {
} }
Future<Void> start(Database const& cx) override { Future<Void> start(Database const& cx) override {
if (clientId == 0) {
return bulkSetup(cx, return bulkSetup(cx,
this, this,
nodeCount, nodeCount,
@ -93,8 +94,15 @@ struct BulkSetupWorkload : TestWorkload {
0, 0,
tenantNames); tenantNames);
} }
return Void();
}
Future<Void> setup(Database const& cx) override { return _setup(this, cx); } Future<Void> setup(Database const& cx) override {
if (clientId == 0) {
return _setup(this, cx);
}
return Void();
}
Future<bool> check(Database const& cx) override { return true; } Future<bool> check(Database const& cx) override { return true; }
}; };

View File

@ -14,8 +14,8 @@ simBackupAgents = 'BackupToFile'
[[test.workload]] [[test.workload]]
testName = 'BulkLoadWithTenants' testName = 'BulkLoadWithTenants'
maxNumTenantsPerClient = 100 maxNumTenants = 100
minNumTenantsPerClient = 0 minNumTenants = 0
transactionsPerSecond = 2500.0 transactionsPerSecond = 2500.0
[[test.workload]] [[test.workload]]