Minor bug fix

This commit is contained in:
Markus Pilman 2023-02-06 17:34:46 +01:00
parent 1fb3c33b3f
commit f321933bc9
3 changed files with 37 additions and 2 deletions

View File

@ -9009,16 +9009,17 @@ private:
void StorageServer::insertTenant(TenantMapEntry const& tenant, Version version, bool persist) {
if (version >= tenantMap.getLatestVersion()) {
TenantSSInfo tenantSSInfo{ tenant.tenantName, tenant.tenantLockState };
int64_t tenantId = TenantAPI::prefixToId(tenant.prefix);
tenantMap.createNewVersion(version);
tenantMap.insert(tenant.id, TenantSSInfo{ tenant.tenantName, tenant.tenantLockState });
tenantMap.insert(tenant.id, tenantSSInfo);
if (persist) {
auto& mLV = addVersionToMutationLog(version);
addMutationToMutationLog(mLV,
MutationRef(MutationRef::SetValue,
tenant.prefix.withPrefix(persistTenantMapKeys.begin),
tenant.tenantName));
ObjectWriter::toValue(tenantSSInfo, IncludeVersion())));
}
TraceEvent("InsertTenant", thisServerID).detail("Tenant", tenantId).detail("Version", version);

View File

@ -1727,12 +1727,24 @@ struct TenantManagementWorkload : TestWorkload {
}
}
ACTOR static Future<Void> delayedTrace(int opCode) {
state double start = now();
loop {
wait(delay(1.0));
TraceEvent("TenantManagementOpNotFinishedAfter")
.detail("Duration", now() - start)
.detail("OpCode", opCode)
.log();
}
}
ACTOR Future<Void> _start(Database cx, TenantManagementWorkload* self) {
state double start = now();
// 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, 8);
state Future<Void> logger = delayedTrace(operation);
if (operation == 0) {
wait(createTenant(self));
} else if (operation == 1) {

View File

@ -0,0 +1,22 @@
[configuration]
allowDefaultTenant = false
tenantModes = ['optional', 'required']
[[test]]
testTitle = 'TenantCreation'
[[test.workload]]
testName = 'CreateTenant'
name = 'First'
[[test.workload]]
testName = 'CreateTenant'
name = 'Second'
[[test]]
testTitle = 'TenantLock'
[[test.workload]]
testName = 'TenantLock'
tenant1 = 'First'
tenant2 = 'Second'