Skip to content

Commit

Permalink
Exclude unused attributes in dashboard copies from getAllDashboardsMe…
Browse files Browse the repository at this point in the history
…tadataCopy

Signed-off-by: Misiu Godfrey <misiu.godfrey@kraken.mapd.com>
  • Loading branch information
paul-aiyedun authored and misiugodfrey committed Aug 26, 2024
1 parent 3fe46bd commit fffa098
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Catalog/Catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2217,12 +2217,19 @@ list<const DashboardDescriptor*> Catalog::getAllDashboardsMetadata() const {
return dashboards;
}

std::vector<DashboardDescriptor> Catalog::getAllDashboardsMetadataCopy() const {
std::vector<DashboardDescriptor> Catalog::getAllDashboardsMetadataForSysTable() const {
cat_read_lock read_lock(this);
std::vector<DashboardDescriptor> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Catalog final {
std::list<const TableDescriptor*> getAllTableMetadata() const;
std::vector<TableDescriptor> getAllTableMetadataCopy() const;
std::list<const DashboardDescriptor*> getAllDashboardsMetadata() const;
std::vector<DashboardDescriptor> getAllDashboardsMetadataCopy() const;
std::vector<DashboardDescriptor> getAllDashboardsMetadataForSysTable() const;
const DBMetadata& getCurrentDB() const { return currentDB_; }
Data_Namespace::DataMgr& getDataMgr() const { return *dataMgr_; }
std::shared_ptr<Calcite> getCalciteMgr() const { return calciteMgr_; }
Expand Down
2 changes: 1 addition & 1 deletion DataMgr/ForeignStorage/InternalCatalogDataWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ std::map<int32_t, std::vector<DashboardDescriptor>> 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);
}
}
Expand Down

0 comments on commit fffa098

Please sign in to comment.