Fix compilation error due to TenantLockState being moved to a different namespace

This commit is contained in:
Markus Pilman 2023-02-22 15:21:47 -07:00
parent 51bd28851b
commit 4e31cd7582
3 changed files with 14 additions and 11 deletions

View File

@ -704,7 +704,7 @@ private:
}
}
if (lockedTenants) {
if (tenantEntry.tenantLockState == TenantLockState::UNLOCKED) {
if (tenantEntry.tenantLockState == TenantAPI::TenantLockState::UNLOCKED) {
lockedTenants->erase(tenantEntry.id);
} else {
lockedTenants->insert(tenantEntry.id);

View File

@ -751,7 +751,7 @@ bool SSPhysicalShard::hasRange(Reference<ShardInfo> shard) const {
struct TenantSSInfo {
constexpr static FileIdentifier file_identifier = 3253114;
TenantLockState lockState;
TenantAPI::TenantLockState lockState;
template <class Ar>
void serialize(Ar& ar) {
@ -2097,7 +2097,7 @@ void StorageServer::checkTenantEntry(Version version, TenantInfo tenantInfo, boo
.detail("Tenant", tenantInfo.tenantId)
.backtrace();
throw tenant_not_found();
} else if (!lockAware && itr->lockState == TenantLockState::LOCKED) {
} else if (!lockAware && itr->lockState == TenantAPI::TenantLockState::LOCKED) {
throw tenant_locked();
}
}
@ -5229,7 +5229,7 @@ TEST_CASE("/fdbserver/storageserver/rangeIntersectsAnyTenant") {
VersionedMap<int64_t, TenantSSInfo> tenantMap;
tenantMap.createNewVersion(1);
for (auto entry : entries) {
tenantMap.insert(entry, TenantSSInfo{ TenantLockState::UNLOCKED });
tenantMap.insert(entry, TenantSSInfo{ TenantAPI::TenantLockState::UNLOCKED });
}
// Before all tenants
@ -5320,7 +5320,7 @@ TEST_CASE("/fdbserver/storageserver/randomRangeIntersectsAnyTenant") {
int numEntries = deterministicRandom()->randomInt(0, 20);
for (int i = 0; i < numEntries; ++i) {
int64_t tenantId = deterministicRandom()->randomInt64(0, std::numeric_limits<int64_t>::max());
tenantMap.insert(tenantId, TenantSSInfo{ TenantLockState::UNLOCKED });
tenantMap.insert(tenantId, TenantSSInfo{ TenantAPI::TenantLockState::UNLOCKED });
tenantPrefixes.insert(TenantAPI::idToPrefix(tenantId));
}

View File

@ -76,7 +76,10 @@ struct TenantLock : TestWorkload {
}
}
ACTOR static Future<Void> changeLockState(Database db, TenantName name, TenantLockState desiredState, UID lockID) {
ACTOR static Future<Void> changeLockState(Database db,
TenantName name,
TenantAPI::TenantLockState desiredState,
UID lockID) {
state Reference<Tenant> tenant = makeReference<Tenant>(db, name);
state ReadYourWritesTransaction tr(db);
tr.setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS);
@ -105,8 +108,8 @@ struct TenantLock : TestWorkload {
.detail("LockID1", lockID1)
.detail("LockID2", lockID2)
.log();
wait(changeLockState(db, self->tenant1, TenantLockState::LOCKED, lockID1));
wait(changeLockState(db, self->tenant2, TenantLockState::LOCKED, lockID2));
wait(changeLockState(db, self->tenant1, TenantAPI::TenantLockState::LOCKED, lockID1));
wait(changeLockState(db, self->tenant2, TenantAPI::TenantLockState::LOCKED, lockID2));
TraceEvent("TenantLockProgress").detail("Phase", "Tx against locked tenant").log();
wait(testExpectedError(success(probeTx(db, self->tenant1, currentValue1)),
"AccessLockedTenant",
@ -130,7 +133,7 @@ struct TenantLock : TestWorkload {
TraceEvent("TenantLockProgress").detail("Phase", "Read-write Tx against locked tenant with lock-aware").log();
wait(store(currentValue2, probeTx(db, self->tenant2, currentValue2, false, LockAwareTx::READ_WRITE)));
TraceEvent("TenantLockProgress").detail("Phase", "Unlock tenant1").log();
wait(changeLockState(db, self->tenant1, TenantLockState::UNLOCKED, lockID1));
wait(changeLockState(db, self->tenant1, TenantAPI::TenantLockState::UNLOCKED, lockID1));
TraceEvent("TenantLockProgress").detail("Phase", "Tx against unlocked tenant1").log();
wait(store(currentValue1, probeTx(db, self->tenant1, currentValue1)));
TraceEvent("TenantLockProgress").detail("Phase", "Tx against locked tenant2").log();
@ -141,14 +144,14 @@ struct TenantLock : TestWorkload {
{},
Error::fromCode(error_code_internal_error)));
TraceEvent("TenantLockProgress").detail("Phase", "Unlock tenant2 with wrong lockID").log();
wait(testExpectedError(changeLockState(db, self->tenant2, TenantLockState::UNLOCKED, lockID1),
wait(testExpectedError(changeLockState(db, self->tenant2, TenantAPI::TenantLockState::UNLOCKED, lockID1),
"UnlockWithWrongID",
tenant_locked(),
Optional<bool*>(),
{},
Error::fromCode(error_code_internal_error)));
TraceEvent("TenantLockProgress").detail("Phase", "Unlock tenant2").log();
wait(changeLockState(db, self->tenant2, TenantLockState::UNLOCKED, lockID2));
wait(changeLockState(db, self->tenant2, TenantAPI::TenantLockState::UNLOCKED, lockID2));
TraceEvent("TenantLockProgress").detail("Phase", "Second Tx against both unlocked tenants").log();
wait(store(currentValue1, probeTx(db, self->tenant1, currentValue1)));
wait(store(currentValue2, probeTx(db, self->tenant2, currentValue2)));