From fffa098ba62344c9ebcc6dc59906a45dbca86c46 Mon Sep 17 00:00:00 2001 From: Paul Aiyedun Date: Fri, 17 Nov 2023 16:20:11 -0800 Subject: [PATCH] Exclude unused attributes in dashboard copies from getAllDashboardsMetadataCopy Signed-off-by: Misiu Godfrey --- Catalog/Catalog.cpp | 11 +++++++++-- Catalog/Catalog.h | 2 +- DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Catalog/Catalog.cpp b/Catalog/Catalog.cpp index ed7ddd6020..7d44626288 100644 --- a/Catalog/Catalog.cpp +++ b/Catalog/Catalog.cpp @@ -2217,12 +2217,19 @@ list Catalog::getAllDashboardsMetadata() const { return dashboards; } -std::vector Catalog::getAllDashboardsMetadataCopy() const { +std::vector Catalog::getAllDashboardsMetadataForSysTable() const { cat_read_lock read_lock(this); std::vector dashboards; dashboards.reserve(dashboardDescriptorMap_.size()); for (auto dashboard_entry : dashboardDescriptorMap_) { - dashboards.emplace_back(*dashboard_entry.second); + const auto& cat_dashboard = dashboard_entry.second; + dashboards.emplace_back(); + auto& dashboard = dashboards.back(); + dashboard.dashboardId = cat_dashboard->dashboardId; + dashboard.dashboardName = cat_dashboard->dashboardName; + dashboard.userId = cat_dashboard->userId; + dashboard.updateTime = cat_dashboard->updateTime; + dashboard.dashboardMetadata = cat_dashboard->dashboardMetadata; } return dashboards; } diff --git a/Catalog/Catalog.h b/Catalog/Catalog.h index e7b6ed0b9c..6accb6280b 100644 --- a/Catalog/Catalog.h +++ b/Catalog/Catalog.h @@ -261,7 +261,7 @@ class Catalog final { std::list getAllTableMetadata() const; std::vector getAllTableMetadataCopy() const; std::list getAllDashboardsMetadata() const; - std::vector getAllDashboardsMetadataCopy() const; + std::vector getAllDashboardsMetadataForSysTable() const; const DBMetadata& getCurrentDB() const { return currentDB_; } Data_Namespace::DataMgr& getDataMgr() const { return *dataMgr_; } std::shared_ptr getCalciteMgr() const { return calciteMgr_; } diff --git a/DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp b/DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp index aec87466bd..735bd331d9 100644 --- a/DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp +++ b/DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp @@ -464,7 +464,7 @@ std::map> get_all_dashboards() { auto& sys_catalog = Catalog_Namespace::SysCatalog::instance(); for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) { if (catalog->name() != shared::kInfoSchemaDbName) { - for (const auto& dashboard : catalog->getAllDashboardsMetadataCopy()) { + for (const auto& dashboard : catalog->getAllDashboardsMetadataForSysTable()) { dashboards_by_database[catalog->getDatabaseId()].emplace_back(dashboard); } }