From 24b937f76a65c989e006898e658c10dbefc4dbb7 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Mon, 19 Jun 2023 16:49:53 +0300 Subject: [PATCH 1/5] Fixed compiling foundationdb with the clang 17 compiler. --- fdbserver/tester.actor.cpp | 2 +- fdbserver/workloads/DcLag.actor.cpp | 3 ++- fdbserver/workloads/GcGenerations.actor.cpp | 4 ++-- .../include/metacluster/MetaclusterConsistency.actor.h | 7 ++++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fdbserver/tester.actor.cpp b/fdbserver/tester.actor.cpp index 5324d0cba8..e89d9c3226 100644 --- a/fdbserver/tester.actor.cpp +++ b/fdbserver/tester.actor.cpp @@ -913,7 +913,7 @@ ACTOR Future clearData(Database cx, Optional defaultTenant) { std::vector> deleteFutures; for (auto const& [id, entry] : tenants.results) { - if (entry.tenantName != defaultTenant) { + if (!defaultTenant.present() || entry.tenantName != defaultTenant.get()) { deleteFutures.push_back(TenantAPI::deleteTenantTransaction(&tr, id)); } } diff --git a/fdbserver/workloads/DcLag.actor.cpp b/fdbserver/workloads/DcLag.actor.cpp index dfae76c1cb..5befaa7df5 100644 --- a/fdbserver/workloads/DcLag.actor.cpp +++ b/fdbserver/workloads/DcLag.actor.cpp @@ -75,7 +75,8 @@ struct DcLagWorkload : TestWorkload { std::vector ips; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && process->locality.dcId().get() == g_simulator->remoteDcId) { + if (process->locality.dcId().present() && g_simulator->remoteDcId.present() && + process->locality.dcId().get() == g_simulator->remoteDcId.get()) { ips.push_back(ip); } } diff --git a/fdbserver/workloads/GcGenerations.actor.cpp b/fdbserver/workloads/GcGenerations.actor.cpp index f813b57301..f0691b515a 100644 --- a/fdbserver/workloads/GcGenerations.actor.cpp +++ b/fdbserver/workloads/GcGenerations.actor.cpp @@ -97,8 +97,8 @@ struct GcGenerationsWorkload : TestWorkload { std::vector remoteIps; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && process->locality.dcId().get() == g_simulator->remoteDcId && - !isCoordinator(coordinators, ip)) { + if (process->locality.dcId().present() && g_simulator->remoteDcId.present() && + process->locality.dcId().get() == g_simulator->remoteDcId.get() && !isCoordinator(coordinators, ip)) { remoteIps.push_back(ip); } else { ips.push_back(ip); diff --git a/metacluster/include/metacluster/MetaclusterConsistency.actor.h b/metacluster/include/metacluster/MetaclusterConsistency.actor.h index 43637932c0..cac26c88d1 100644 --- a/metacluster/include/metacluster/MetaclusterConsistency.actor.h +++ b/metacluster/include/metacluster/MetaclusterConsistency.actor.h @@ -213,12 +213,13 @@ private: ASSERT_EQ(data.metaclusterRegistration.get().version, managementData.metaclusterRegistration.get().version); if (data.tenantData.lastTenantId >= 0) { - ASSERT_EQ(TenantAPI::getTenantIdPrefix(data.tenantData.lastTenantId), managementData.tenantIdPrefix); + ASSERT_EQ(TenantAPI::getTenantIdPrefix(data.tenantData.lastTenantId), + managementData.tenantIdPrefix.get()); ASSERT_LE(data.tenantData.lastTenantId, managementData.tenantData.lastTenantId); } else { CODE_PROBE(true, "Data cluster has no tenants with current tenant ID prefix"); for (auto const& [id, tenant] : data.tenantData.tenantMap) { - ASSERT_NE(TenantAPI::getTenantIdPrefix(id), managementData.tenantIdPrefix); + ASSERT_NE(TenantAPI::getTenantIdPrefix(id), managementData.tenantIdPrefix.get()); } } @@ -258,7 +259,7 @@ private: ASSERT_EQ(metaclusterEntry.tenantState, TenantState::READY); ASSERT(entry.tenantName == metaclusterEntry.tenantName); } else if (entry.tenantName != metaclusterEntry.tenantName) { - ASSERT(entry.tenantName == metaclusterEntry.renameDestination); + ASSERT(entry.tenantName == metaclusterEntry.renameDestination.get()); } if (metaclusterEntry.tenantState != TenantState::UPDATING_CONFIGURATION && metaclusterEntry.tenantState != TenantState::REMOVING) { From 533677cb1df17b2449eef1a403c35180581652a3 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Mon, 24 Jul 2023 12:21:02 +0300 Subject: [PATCH 2/5] Fixed compiling with clang 17 (cherry picked from commit 4e218df63aa6da991cb94c9126da5b92a296e3b3) --- metacluster/include/metacluster/ConfigureTenant.actor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metacluster/include/metacluster/ConfigureTenant.actor.h b/metacluster/include/metacluster/ConfigureTenant.actor.h index c1ef471c1a..fc71aafd21 100644 --- a/metacluster/include/metacluster/ConfigureTenant.actor.h +++ b/metacluster/include/metacluster/ConfigureTenant.actor.h @@ -233,7 +233,7 @@ struct ConfigureTenantImpl { return Void(); } - if (self->updatedEntry.toTenantMapEntry() == tenantEntry) { + if (tenantEntry.present() && self->updatedEntry.toTenantMapEntry() == tenantEntry.get()) { // No update to write to data cluster, just return. return Void(); } From 9485191fc8c16d03d3ef180dad519fca59f8db19 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Mon, 24 Jul 2023 16:49:25 +0300 Subject: [PATCH 3/5] Some optimisation (cherry picked from commit 5c6cdae3ba3570e9e376117b9b82a3cbbe0442f2) --- metacluster/include/metacluster/ConfigureTenant.actor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metacluster/include/metacluster/ConfigureTenant.actor.h b/metacluster/include/metacluster/ConfigureTenant.actor.h index fc71aafd21..05965afcff 100644 --- a/metacluster/include/metacluster/ConfigureTenant.actor.h +++ b/metacluster/include/metacluster/ConfigureTenant.actor.h @@ -233,7 +233,7 @@ struct ConfigureTenantImpl { return Void(); } - if (tenantEntry.present() && self->updatedEntry.toTenantMapEntry() == tenantEntry.get()) { + if (self->updatedEntry.toTenantMapEntry() == tenantEntry.get()) { // No update to write to data cluster, just return. return Void(); } From 3c75b5d7de9967cf41d8dc6de5dd0ce9bfc3a799 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Wed, 13 Sep 2023 17:18:06 +0300 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: A.J. Beamon --- fdbserver/workloads/DcLag.actor.cpp | 4 ++-- fdbserver/workloads/GcGenerations.actor.cpp | 4 ++-- .../include/metacluster/MetaclusterConsistency.actor.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fdbserver/workloads/DcLag.actor.cpp b/fdbserver/workloads/DcLag.actor.cpp index 5befaa7df5..d57b5073a0 100644 --- a/fdbserver/workloads/DcLag.actor.cpp +++ b/fdbserver/workloads/DcLag.actor.cpp @@ -75,8 +75,8 @@ struct DcLagWorkload : TestWorkload { std::vector ips; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && g_simulator->remoteDcId.present() && - process->locality.dcId().get() == g_simulator->remoteDcId.get()) { + if (process->locality.dcId().present() && + process->locality.dcId() == g_simulator->remoteDcId) { ips.push_back(ip); } } diff --git a/fdbserver/workloads/GcGenerations.actor.cpp b/fdbserver/workloads/GcGenerations.actor.cpp index f0691b515a..f3e6117010 100644 --- a/fdbserver/workloads/GcGenerations.actor.cpp +++ b/fdbserver/workloads/GcGenerations.actor.cpp @@ -97,8 +97,8 @@ struct GcGenerationsWorkload : TestWorkload { std::vector remoteIps; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && g_simulator->remoteDcId.present() && - process->locality.dcId().get() == g_simulator->remoteDcId.get() && !isCoordinator(coordinators, ip)) { + if (process->locality.dcId().present() && + process->locality.dcId() == g_simulator->remoteDcId && !isCoordinator(coordinators, ip)) { remoteIps.push_back(ip); } else { ips.push_back(ip); diff --git a/metacluster/include/metacluster/MetaclusterConsistency.actor.h b/metacluster/include/metacluster/MetaclusterConsistency.actor.h index cac26c88d1..dd5963d706 100644 --- a/metacluster/include/metacluster/MetaclusterConsistency.actor.h +++ b/metacluster/include/metacluster/MetaclusterConsistency.actor.h @@ -259,7 +259,7 @@ private: ASSERT_EQ(metaclusterEntry.tenantState, TenantState::READY); ASSERT(entry.tenantName == metaclusterEntry.tenantName); } else if (entry.tenantName != metaclusterEntry.tenantName) { - ASSERT(entry.tenantName == metaclusterEntry.renameDestination.get()); + ASSERT(metaclusterEntry.renameDestination.present() && entry.tenantName == metaclusterEntry.renameDestination.get()); } if (metaclusterEntry.tenantState != TenantState::UPDATING_CONFIGURATION && metaclusterEntry.tenantState != TenantState::REMOVING) { From b9b4e1ebe463f467c24c27262b0018e31d95c025 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Wed, 13 Sep 2023 18:55:55 +0300 Subject: [PATCH 5/5] Fixed formatting --- fdbserver/workloads/DcLag.actor.cpp | 3 +-- fdbserver/workloads/GcGenerations.actor.cpp | 4 ++-- .../include/metacluster/MetaclusterConsistency.actor.h | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fdbserver/workloads/DcLag.actor.cpp b/fdbserver/workloads/DcLag.actor.cpp index d57b5073a0..b23dfcbb34 100644 --- a/fdbserver/workloads/DcLag.actor.cpp +++ b/fdbserver/workloads/DcLag.actor.cpp @@ -75,8 +75,7 @@ struct DcLagWorkload : TestWorkload { std::vector ips; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && - process->locality.dcId() == g_simulator->remoteDcId) { + if (process->locality.dcId().present() && process->locality.dcId() == g_simulator->remoteDcId) { ips.push_back(ip); } } diff --git a/fdbserver/workloads/GcGenerations.actor.cpp b/fdbserver/workloads/GcGenerations.actor.cpp index f3e6117010..db7b8cf509 100644 --- a/fdbserver/workloads/GcGenerations.actor.cpp +++ b/fdbserver/workloads/GcGenerations.actor.cpp @@ -97,8 +97,8 @@ struct GcGenerationsWorkload : TestWorkload { std::vector remoteIps; // all remote process IPs for (const auto& process : g_simulator->getAllProcesses()) { const auto& ip = process->address.ip; - if (process->locality.dcId().present() && - process->locality.dcId() == g_simulator->remoteDcId && !isCoordinator(coordinators, ip)) { + if (process->locality.dcId().present() && process->locality.dcId() == g_simulator->remoteDcId && + !isCoordinator(coordinators, ip)) { remoteIps.push_back(ip); } else { ips.push_back(ip); diff --git a/metacluster/include/metacluster/MetaclusterConsistency.actor.h b/metacluster/include/metacluster/MetaclusterConsistency.actor.h index dd5963d706..394f9d016b 100644 --- a/metacluster/include/metacluster/MetaclusterConsistency.actor.h +++ b/metacluster/include/metacluster/MetaclusterConsistency.actor.h @@ -259,7 +259,8 @@ private: ASSERT_EQ(metaclusterEntry.tenantState, TenantState::READY); ASSERT(entry.tenantName == metaclusterEntry.tenantName); } else if (entry.tenantName != metaclusterEntry.tenantName) { - ASSERT(metaclusterEntry.renameDestination.present() && entry.tenantName == metaclusterEntry.renameDestination.get()); + ASSERT(metaclusterEntry.renameDestination.present() && + entry.tenantName == metaclusterEntry.renameDestination.get()); } if (metaclusterEntry.tenantState != TenantState::UPDATING_CONFIGURATION && metaclusterEntry.tenantState != TenantState::REMOVING) {