allow only active tenants to be specified in args and use batch tenant creation in populate

This commit is contained in:
Jon Fu 2022-06-22 10:31:12 -07:00
parent c473a94250
commit aa8982c1fb
1 changed files with 6 additions and 4 deletions

View File

@ -184,10 +184,7 @@ int populate(Database db,
Transaction systemTx = db.createTransaction();
for (int i = 0; i < args.total_tenants; ++i) {
while (true) {
// Until this issue https://github.com/apple/foundationdb/issues/7260 is resolved
// we have to commit each tenant creation transaction one-by-one
// while (i % 10 == 9 || i == args.total_tenants - 1) {
while (i % 10 == 9 || i == args.total_tenants - 1) {
std::string tenant_name = "tenant" + std::to_string(i);
Tenant::createTenant(systemTx, toBytesRef(tenant_name));
auto future_commit = systemTx.commit();
@ -2127,6 +2124,11 @@ int main(int argc, char* argv[]) {
args.row_digits = digits(args.rows);
}
// Allow specifying only the number of active tenants, in which case # active = # total
if (args.active_tenants > 0 && args.total_tenants == 0) {
args.total_tenants = args.active_tenants;
}
rc = validateArguments(args);
if (rc < 0)
return -1;