Fix: when a tenant creation permanently failed on the data cluster and started over, it could incorrectly fail with a tenant already exists error if the subsequent retry successfully committed during a commit_unknown_result error. Also expand the tenant management concurrency workload to include configure operations.

This commit is contained in:
A.J. Beamon 2022-08-05 06:46:46 -07:00
parent ff23d5994e
commit a7653b2859
2 changed files with 6 additions and 8 deletions

View File

@ -1075,13 +1075,12 @@ struct CreateTenantImpl {
state Optional<TenantMapEntry> existingEntry = wait(tryGetTenantTransaction(tr, self->tenantName));
if (existingEntry.present()) {
if (!existingEntry.get().matchesConfiguration(self->tenantEntry) ||
(self->replaceExistingTenantId.present() &&
existingEntry.get().id != self->replaceExistingTenantId.get()) ||
existingEntry.get().tenantState != TenantState::REGISTERING) {
// The tenant already exists and is either completely created, has a different
// configuration, or is a different tenant than the one we intend to replace
// The tenant already exists and is either completely created or has a different
// configuration
throw tenant_already_exists();
} else if (!self->replaceExistingTenantId.present()) {
} else if (!self->replaceExistingTenantId.present() ||
self->replaceExistingTenantId.get() != existingEntry.get().id) {
// The tenant creation has already started, so resume where we left off
self->tenantEntry = existingEntry.get();
ASSERT(existingEntry.get().assignedCluster.present());

View File

@ -251,14 +251,13 @@ struct TenantManagementConcurrencyWorkload : TestWorkload {
Optional<Void> result = wait(timeout(configureImpl(self, tenant, configParams), 30));
if (result.present()) {
fmt::print("Delete tenant success: {}\n", printable(tenant));
break;
}
}
return Void();
} catch (Error& e) {
if (e.code() != error_code_tenant_not_found) {
if (e.code() != error_code_tenant_not_found && e.code() != error_code_invalid_tenant_state) {
TraceEvent(SevError, "ConfigureTenantFailure").error(e).detail("TenantName", tenant);
}
return Void();
@ -271,7 +270,7 @@ struct TenantManagementConcurrencyWorkload : TestWorkload {
// Run a random sequence of tenant management operations for the duration of the test
while (now() < start + self->testDuration) {
state int operation = deterministicRandom()->randomInt(0, 2);
state int operation = deterministicRandom()->randomInt(0, 3);
if (operation == 0) {
wait(createTenant(self));
} else if (operation == 1) {