Fix some merge related issues
This commit is contained in:
parent
279296c29f
commit
978ca7fb6f
|
@ -71,13 +71,19 @@ TenantState TenantMapEntry::stringToTenantState(std::string stateStr) {
|
|||
}
|
||||
|
||||
TenantMapEntry::TenantMapEntry() {}
|
||||
TenantMapEntry::TenantMapEntry(int64_t id, TenantState tenantState)
|
||||
: id(id), idToPrefix(id), tenantState(tenantState) {}
|
||||
TenantMapEntry::TenantMapEntry(int64_t id,
|
||||
KeyRef subspace,
|
||||
Optional<TenantGroupName> tenantGroup,
|
||||
TenantState tenantState)
|
||||
: id(id), prefix(idToPrefix(id)) tenantGroup(tenantGroup), tenantState(tenantState) {}
|
||||
TenantMapEntry::TenantMapEntry(int64_t id, TenantState tenantState) : tenantState(tenantState) {
|
||||
setId(id);
|
||||
}
|
||||
TenantMapEntry::TenantMapEntry(int64_t id, Optional<TenantGroupName> tenantGroup, TenantState tenantState)
|
||||
: tenantGroup(tenantGroup), tenantState(tenantState) {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
void TenantMapEntry::setId(int64_t id) {
|
||||
ASSERT(id >= 0);
|
||||
this->id = id;
|
||||
prefix = idToPrefix(id);
|
||||
}
|
||||
|
||||
bool TenantMapEntry::matchesConfiguration(TenantMapEntry const& other) const {
|
||||
return tenantGroup == other.tenantGroup;
|
||||
|
|
|
@ -994,7 +994,6 @@ struct CreateTenantImpl {
|
|||
return std::make_pair(existingEntry.get(), false);
|
||||
}
|
||||
|
||||
self->tenantEntry.setSubspace(""_sr);
|
||||
self->tenantEntry.tenantState = TenantState::REGISTERING;
|
||||
ManagementClusterMetadata::tenantMetadata.tenantMap.set(tr, self->tenantName, self->tenantEntry);
|
||||
|
||||
|
@ -1021,7 +1020,7 @@ struct CreateTenantImpl {
|
|||
self->clusterMetadata = assignment.second;
|
||||
|
||||
Optional<int64_t> lastId = wait(ManagementClusterMetadata::tenantMetadata.lastTenantId.get(tr));
|
||||
self->tenantEntry.id = lastId.orDefault(-1) + 1;
|
||||
self->tenantEntry.setId(lastId.orDefault(-1) + 1);
|
||||
|
||||
std::pair<TenantMapEntry, bool> result = wait(managementClusterCreateTenant(self, tr));
|
||||
state TenantMapEntry createdEntry = result.first;
|
||||
|
|
|
@ -43,7 +43,6 @@ struct TenantMapEntry {
|
|||
static std::string tenantStateToString(TenantState tenantState);
|
||||
static TenantState stringToTenantState(std::string stateStr);
|
||||
|
||||
Arena arena;
|
||||
int64_t id = -1;
|
||||
Key prefix;
|
||||
Optional<TenantGroupName> tenantGroup;
|
||||
|
@ -58,6 +57,8 @@ struct TenantMapEntry {
|
|||
TenantMapEntry(int64_t id, TenantState tenantState);
|
||||
TenantMapEntry(int64_t id, Optional<TenantGroupName> tenantGroup, TenantState tenantState);
|
||||
|
||||
void setId(int64_t id);
|
||||
|
||||
bool matchesConfiguration(TenantMapEntry const& other) const;
|
||||
void configure(Standalone<StringRef> parameter, Optional<Value> value);
|
||||
|
||||
|
@ -75,8 +76,10 @@ struct TenantMapEntry {
|
|||
template <class Ar>
|
||||
void serialize(Ar& ar) {
|
||||
serializer(ar, id, tenantGroup, tenantState, assignedCluster, configurationSequenceNum);
|
||||
if (ar.isDeserializing) {
|
||||
prefix = idToPrefix(id);
|
||||
if constexpr (Ar::isDeserializing) {
|
||||
if (id >= 0) {
|
||||
prefix = idToPrefix(id);
|
||||
}
|
||||
ASSERT(tenantState >= TenantState::REGISTERING && tenantState <= TenantState::ERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,8 +116,6 @@ Future<std::pair<Optional<TenantMapEntry>, bool>> createTenantTransaction(
|
|||
ASSERT(clusterType != ClusterType::METACLUSTER_MANAGEMENT);
|
||||
ASSERT(tenantEntry.id >= 0);
|
||||
|
||||
ASSERT(tenantEntry.id >= 0);
|
||||
|
||||
if (name.startsWith("\xff"_sr)) {
|
||||
throw invalid_tenant_name();
|
||||
}
|
||||
|
@ -201,8 +199,8 @@ Future<Optional<TenantMapEntry>> createTenant(Reference<DB> db,
|
|||
|
||||
if (generateTenantId) {
|
||||
int64_t tenantId = wait(tenantIdFuture);
|
||||
tenantEntry.id = tenantId;
|
||||
TenantMetadata::lastTenantId.set(tr, tenantEntry.id);
|
||||
tenantEntry.setId(tenantId);
|
||||
TenantMetadata::lastTenantId.set(tr, tenantId);
|
||||
}
|
||||
|
||||
state std::pair<Optional<TenantMapEntry>, bool> newTenant =
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
std::vector<std::pair<Standalone<StringRef>, Optional<Value>>> configMutations,
|
||||
int64_t tenantId) {
|
||||
state TenantMapEntry tenantEntry;
|
||||
tenantEntry.id = tenantId;
|
||||
tenantEntry.setId(tenantId);
|
||||
|
||||
for (auto const& [name, value] : configMutations) {
|
||||
tenantEntry.configure(name, value);
|
||||
|
|
|
@ -702,7 +702,7 @@ private:
|
|||
}
|
||||
|
||||
confChange = true;
|
||||
TEST(true); // Metacluster registration set
|
||||
CODE_PROBE(true, "Metacluster registration set");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ private:
|
|||
}
|
||||
|
||||
confChange = true;
|
||||
TEST(true); // Metacluster registration cleared
|
||||
CODE_PROBE(true, "Metacluster registration cleared");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -359,8 +359,8 @@ public:
|
|||
loadIniFile(testFile);
|
||||
return;
|
||||
}
|
||||
ConfigBuilder builder;
|
||||
std::string extraDatabaseModeStr;
|
||||
ConfigBuilder builder;
|
||||
builder.add("extraDatabaseMode", &extraDatabaseModeStr)
|
||||
.add("extraDatabaseCount", &extraDatabaseCount)
|
||||
.add("minimumReplication", &minimumReplication)
|
||||
|
|
|
@ -264,7 +264,7 @@ struct TenantManagementWorkload : TestWorkload {
|
|||
|
||||
std::vector<Future<Void>> createFutures;
|
||||
for (auto [tenant, entry] : tenantsToCreate) {
|
||||
entry.id = nextId++;
|
||||
entry.setId(nextId++);
|
||||
createFutures.push_back(success(TenantAPI::createTenantTransaction(tr, tenant, entry)));
|
||||
}
|
||||
TenantMetadata::lastTenantId.set(tr, nextId - 1);
|
||||
|
|
Loading…
Reference in New Issue