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;
double transactionsPerSecond;
Key keyPrefix;
double maxNumTenantsPerClient;
double minNumTenantsPerClient;
double maxNumTenants;
double minNumTenants;
std::vector<TenantName> tenantNames;
BulkSetupWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {
@ -42,9 +42,9 @@ struct BulkSetupWorkload : TestWorkload {
nodeCount = getOption(options, "nodeCount"_sr, transactionsPerSecond * clientCount);
keyPrefix = unprintable(getOption(options, "keyPrefix"_sr, ""_sr).toString());
// maximum and minimum number of tenants per client
maxNumTenantsPerClient = getOption(options, "maxNumTenantsPerClient"_sr, 0);
minNumTenantsPerClient = getOption(options, "minNumTenantsPerClient"_sr, 0);
ASSERT(minNumTenantsPerClient <= maxNumTenantsPerClient);
maxNumTenants = getOption(options, "maxNumTenants"_sr, 0);
minNumTenants = getOption(options, "minNumTenants"_sr, 0);
ASSERT(minNumTenants <= maxNumTenants);
}
void getMetrics(std::vector<PerfMetric>& m) override {}
@ -58,14 +58,14 @@ struct BulkSetupWorkload : TestWorkload {
ACTOR static Future<Void> _setup(BulkSetupWorkload* workload, Database cx) {
// create a bunch of tenants (between min and max tenants)
state int numTenantsToCreate =
deterministicRandom()->randomInt(workload->minNumTenantsPerClient, workload->maxNumTenantsPerClient + 1);
deterministicRandom()->randomInt(workload->minNumTenants, workload->maxNumTenants + 1);
TraceEvent("BulkSetupTenantCreation").detail("NumTenants", numTenantsToCreate);
if (numTenantsToCreate > 0) {
std::vector<Future<Void>> tenantFutures;
for (int i = 0; i < numTenantsToCreate; i++) {
TenantMapEntry entry;
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")
.detail("Tenant", workload->tenantNames.back())
.detail("TenantGroup", entry.tenantGroup);
@ -78,23 +78,31 @@ struct BulkSetupWorkload : TestWorkload {
}
Future<Void> start(Database const& cx) override {
return bulkSetup(cx,
this,
nodeCount,
Promise<double>(),
false,
0.0,
1e12,
std::vector<uint64_t>(),
Promise<std::vector<std::pair<uint64_t, double>>>(),
0,
0.1,
0,
0,
tenantNames);
if (clientId == 0) {
return bulkSetup(cx,
this,
nodeCount,
Promise<double>(),
false,
0.0,
1e12,
std::vector<uint64_t>(),
Promise<std::vector<std::pair<uint64_t, double>>>(),
0,
0.1,
0,
0,
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; }
};

View File

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