From 7cc58cb1afe28b1cd2dd155cf727b5f63983e73f Mon Sep 17 00:00:00 2001 From: Nim Wijetunga Date: Tue, 26 Jul 2022 10:14:59 -0700 Subject: [PATCH] fix pr issues --- fdbclient/include/fdbclient/TenantManagement.actor.h | 7 ++----- fdbclient/include/fdbclient/TenantSpecialKeys.actor.h | 3 ++- fdbserver/ClusterController.actor.cpp | 8 ++++---- fdbserver/TenantCache.actor.cpp | 6 +++--- fdbserver/tester.actor.cpp | 3 ++- .../workloads/BlobGranuleCorrectnessWorkload.actor.cpp | 2 +- fdbserver/workloads/FuzzApiCorrectness.actor.cpp | 4 +++- fdbserver/workloads/TenantManagementWorkload.actor.cpp | 4 ++-- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/fdbclient/include/fdbclient/TenantManagement.actor.h b/fdbclient/include/fdbclient/TenantManagement.actor.h index f76bdf0a80..db32f1130a 100644 --- a/fdbclient/include/fdbclient/TenantManagement.actor.h +++ b/fdbclient/include/fdbclient/TenantManagement.actor.h @@ -96,8 +96,7 @@ Future checkTenantMode(Transaction tr) { ACTOR template Future, bool>> createTenantTransaction(Transaction tr, TenantNameRef name, - TenantMapEntry tenantEntry, - bool encrypted) { + TenantMapEntry tenantEntry) { ASSERT(tenantEntry.id >= 0); if (name.startsWith("\xff"_sr)) { @@ -130,7 +129,6 @@ Future, bool>> createTenantTransaction(Transa } tenantEntry.tenantState = TenantState::READY; - tenantEntry.encrypted = encrypted; TenantMetadata::tenantMap.set(tr, name, tenantEntry); if (tenantEntry.tenantGroup.present()) { TenantMetadata::tenantGroupTenantIndex.insert(tr, Tuple::makeTuple(tenantEntry.tenantGroup.get(), name)); @@ -158,7 +156,6 @@ Future getNextTenantId(Transaction tr) { ACTOR template Future> createTenant(Reference db, TenantName name, - bool encrypted, TenantMapEntry tenantEntry = TenantMapEntry()) { state Reference tr = db->createTransaction(); @@ -191,7 +188,7 @@ Future> createTenant(Reference db, } state std::pair, bool> newTenant = - wait(createTenantTransaction(tr, name, tenantEntry, encrypted)); + wait(createTenantTransaction(tr, name, tenantEntry)); if (newTenant.second) { ASSERT(newTenant.first.present()); diff --git a/fdbclient/include/fdbclient/TenantSpecialKeys.actor.h b/fdbclient/include/fdbclient/TenantSpecialKeys.actor.h index 3638a2779d..3392c15db1 100644 --- a/fdbclient/include/fdbclient/TenantSpecialKeys.actor.h +++ b/fdbclient/include/fdbclient/TenantSpecialKeys.actor.h @@ -117,6 +117,7 @@ private: bool encrypted) { state TenantMapEntry tenantEntry; tenantEntry.setId(tenantId); + tenantEntry.encrypted = encrypted; for (auto const& [name, value] : configMutations) { tenantEntry.configure(name, value); @@ -127,7 +128,7 @@ private: } std::pair, bool> entry = - wait(TenantAPI::createTenantTransaction(&ryw->getTransaction(), tenantName, tenantEntry, encrypted)); + wait(TenantAPI::createTenantTransaction(&ryw->getTransaction(), tenantName, tenantEntry)); return Void(); } diff --git a/fdbserver/ClusterController.actor.cpp b/fdbserver/ClusterController.actor.cpp index f5eefc737e..485d3ab3cb 100644 --- a/fdbserver/ClusterController.actor.cpp +++ b/fdbserver/ClusterController.actor.cpp @@ -248,7 +248,7 @@ ACTOR Future clusterWatchDatabase(ClusterControllerData* cluster, dbInfo.latencyBandConfig = db->serverInfo->get().latencyBandConfig; dbInfo.myLocality = db->serverInfo->get().myLocality; dbInfo.client = ClientDBInfo(); - dbInfo.client.isEncryptionEnabled = db->serverInfo->get().encryptKeyProxy.present(); + dbInfo.client.isEncryptionEnabled = SERVER_KNOBS->ENABLE_ENCRYPTION; dbInfo.client.tenantMode = db->config.tenantMode; dbInfo.client.clusterId = db->serverInfo->get().client.clusterId; @@ -1013,7 +1013,7 @@ void clusterRegisterMaster(ClusterControllerData* self, RegisterMasterRequest co if (db->clientInfo->get().commitProxies != req.commitProxies || db->clientInfo->get().grvProxies != req.grvProxies || db->clientInfo->get().tenantMode != db->config.tenantMode || db->clientInfo->get().clusterId != req.clusterId || - db->clientInfo->get().isEncryptionEnabled != db->serverInfo->get().encryptKeyProxy.present()) { + db->clientInfo->get().isEncryptionEnabled != SERVER_KNOBS->ENABLE_ENCRYPTION) { TraceEvent("PublishNewClientInfo", self->id) .detail("Master", dbInfo.master.id()) .detail("GrvProxies", db->clientInfo->get().grvProxies) @@ -1023,13 +1023,13 @@ void clusterRegisterMaster(ClusterControllerData* self, RegisterMasterRequest co .detail("TenantMode", db->clientInfo->get().tenantMode.toString()) .detail("ReqTenantMode", db->config.tenantMode.toString()) .detail("ClusterId", db->clientInfo->get().clusterId) - .detail("EncryptionEnabled", db->serverInfo->get().encryptKeyProxy.present()) + .detail("EncryptionEnabled", SERVER_KNOBS->ENABLE_ENCRYPTION) .detail("ReqClusterId", req.clusterId); isChanged = true; // TODO why construct a new one and not just copy the old one and change proxies + id? ClientDBInfo clientInfo; clientInfo.id = deterministicRandom()->randomUniqueID(); - clientInfo.isEncryptionEnabled = db->serverInfo->get().encryptKeyProxy.present(); + clientInfo.isEncryptionEnabled = SERVER_KNOBS->ENABLE_ENCRYPTION; clientInfo.commitProxies = req.commitProxies; clientInfo.grvProxies = req.grvProxies; clientInfo.tenantMode = db->config.tenantMode; diff --git a/fdbserver/TenantCache.actor.cpp b/fdbserver/TenantCache.actor.cpp index 88105e69b9..171361a40c 100644 --- a/fdbserver/TenantCache.actor.cpp +++ b/fdbserver/TenantCache.actor.cpp @@ -217,7 +217,7 @@ public: for (uint16_t i = 0; i < tenantCount; i++) { TenantName tenantName(format("%s_%08d", "ddtc_test_tenant", tenantNumber + i)); - TenantMapEntry tenant(tenantNumber + i, TenantState::READY, false); + TenantMapEntry tenant(tenantNumber + i, TenantState::READY, SERVER_KNOBS->ENABLE_ENCRYPTION); tenantCache.insert(tenantName, tenant); } @@ -245,7 +245,7 @@ public: for (uint16_t i = 0; i < tenantCount; i++) { TenantName tenantName(format("%s_%08d", "ddtc_test_tenant", tenantNumber + i)); - TenantMapEntry tenant(tenantNumber + i, TenantState::READY, false); + TenantMapEntry tenant(tenantNumber + i, TenantState::READY, SERVER_KNOBS->ENABLE_ENCRYPTION); tenantCache.insert(tenantName, tenant); } @@ -259,7 +259,7 @@ public: if (tenantOrdinal % staleTenantFraction != 0) { TenantName tenantName(format("%s_%08d", "ddtc_test_tenant", tenantOrdinal)); - TenantMapEntry tenant(tenantOrdinal, TenantState::READY, false); + TenantMapEntry tenant(tenantOrdinal, TenantState::READY, SERVER_KNOBS->ENABLE_ENCRYPTION); bool newTenant = tenantCache.update(tenantName, tenant); ASSERT(!newTenant); keepCount++; diff --git a/fdbserver/tester.actor.cpp b/fdbserver/tester.actor.cpp index 29f2eaa737..9958fbc57a 100644 --- a/fdbserver/tester.actor.cpp +++ b/fdbserver/tester.actor.cpp @@ -1637,8 +1637,9 @@ ACTOR Future runTests(Referencecoinflip()) { entry.tenantGroup = "TestTenantGroup"_sr; } + entry.encrypted = SERVER_KNOBS->ENABLE_ENCRYPTION; TraceEvent("CreatingTenant").detail("Tenant", tenant).detail("TenantGroup", entry.tenantGroup); - tenantFutures.push_back(success(TenantAPI::createTenant(cx.getReference(), tenant, false, entry))); + tenantFutures.push_back(success(TenantAPI::createTenant(cx.getReference(), tenant, entry))); } wait(waitForAll(tenantFutures)); diff --git a/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp b/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp index 5b70ebf2e9..a529c79d9a 100644 --- a/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp +++ b/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp @@ -212,7 +212,7 @@ struct BlobGranuleCorrectnessWorkload : TestWorkload { fmt::print("Setting up blob granule range for tenant {0}\n", name.printable()); } - Optional entry = wait(TenantAPI::createTenant(cx.getReference(), name, false)); + Optional entry = wait(TenantAPI::createTenant(cx.getReference(), name)); ASSERT(entry.present()); if (BGW_DEBUG) { diff --git a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp index b9d86b3a9a..77c062b100 100644 --- a/fdbserver/workloads/FuzzApiCorrectness.actor.cpp +++ b/fdbserver/workloads/FuzzApiCorrectness.actor.cpp @@ -24,6 +24,7 @@ #include #include "fdbclient/FDBOptions.g.h" +#include "fdbserver/Knobs.h" #include "fdbserver/TesterInterface.actor.h" #include "fdbclient/GenericManagementAPI.actor.h" #include "fdbclient/TenantManagement.actor.h" @@ -240,8 +241,9 @@ struct FuzzApiCorrectnessWorkload : TestWorkload { if (i < self->numTenants) { TenantMapEntry entry; entry.tenantGroup = self->getTenantGroup(i); + entry.encrypted = SERVER_KNOBS->ENABLE_ENCRYPTION; tenantFutures.push_back( - ::success(TenantAPI::createTenant(cx.getReference(), tenantName, false, entry))); + ::success(TenantAPI::createTenant(cx.getReference(), tenantName, entry))); self->createdTenants.insert(tenantName); } } diff --git a/fdbserver/workloads/TenantManagementWorkload.actor.cpp b/fdbserver/workloads/TenantManagementWorkload.actor.cpp index 2e1be51f45..82f66115d2 100644 --- a/fdbserver/workloads/TenantManagementWorkload.actor.cpp +++ b/fdbserver/workloads/TenantManagementWorkload.actor.cpp @@ -158,7 +158,6 @@ struct TenantManagementWorkload : TestWorkload { ASSERT(tenantsToCreate.size() == 1); wait(success(TenantAPI::createTenant(cx.getReference(), tenantsToCreate.begin()->first, - SERVER_KNOBS->ENABLE_ENCRYPTION, tenantsToCreate.begin()->second))); } else if (operationType == OperationType::MANAGEMENT_TRANSACTION) { tr->setOption(FDBTransactionOptions::ACCESS_SYSTEM_KEYS); @@ -169,7 +168,7 @@ struct TenantManagementWorkload : TestWorkload { for (auto [tenant, entry] : tenantsToCreate) { entry.setId(nextId++); createFutures.push_back( - success(TenantAPI::createTenantTransaction(tr, tenant, entry, SERVER_KNOBS->ENABLE_ENCRYPTION))); + success(TenantAPI::createTenantTransaction(tr, tenant, entry))); } TenantMetadata::lastTenantId.set(tr, nextId - 1); wait(waitForAll(createFutures)); @@ -207,6 +206,7 @@ struct TenantManagementWorkload : TestWorkload { TenantMapEntry entry; entry.tenantGroup = self->chooseTenantGroup(true); + entry.encrypted = SERVER_KNOBS->ENABLE_ENCRYPTION; tenantsToCreate[tenant] = entry; alreadyExists = alreadyExists || self->createdTenants.count(tenant);