OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::InternalStorageStatsDataWrapper Class Reference

#include <InternalStorageStatsDataWrapper.h>

+ Inheritance diagram for foreign_storage::InternalStorageStatsDataWrapper:
+ Collaboration diagram for foreign_storage::InternalStorageStatsDataWrapper:

Public Member Functions

 InternalStorageStatsDataWrapper ()
 
 InternalStorageStatsDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
- Public Member Functions inherited from foreign_storage::InternalSystemDataWrapper
 InternalSystemDataWrapper ()
 
 InternalSystemDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
void populateChunkMetadata (ChunkMetadataVector &chunk_metadata_vector) override
 
void populateChunkBuffers (const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers) override
 
void validateServerOptions (const ForeignServer *foreign_server) const override
 
void validateTableOptions (const ForeignTable *foreign_table) const override
 
const std::set
< std::string_view > & 
getSupportedTableOptions () const override
 
void validateUserMappingOptions (const UserMapping *user_mapping, const ForeignServer *foreign_server) const override
 
const std::set
< std::string_view > & 
getSupportedUserMappingOptions () const override
 
std::string getSerializedDataWrapper () const override
 
void restoreDataWrapperInternals (const std::string &file_path, const ChunkMetadataVector &chunk_metadata) override
 
bool isRestored () const override
 
- Public Member Functions inherited from foreign_storage::ForeignDataWrapper
 ForeignDataWrapper ()=default
 
virtual ~ForeignDataWrapper ()=default
 
virtual void validateSchema (const std::list< ColumnDescriptor > &columns) const
 
virtual ParallelismLevel getCachedParallelismLevel () const
 
virtual ParallelismLevel getNonCachedParallelismLevel () const
 

Private Member Functions

void initializeObjectsForTable (const std::string &table_name) override
 
void populateChunkBuffersForTable (const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers) override
 

Private Attributes

std::vector< StorageDetailsstorage_details_
 

Additional Inherited Members

- Public Types inherited from foreign_storage::ForeignDataWrapper
enum  ParallelismLevel { NONE, INTRA_FRAGMENT, INTER_FRAGMENT }
 
- Protected Attributes inherited from foreign_storage::InternalSystemDataWrapper
const int db_id_
 
const ForeignTableforeign_table_
 
size_t row_count_ {0}
 

Detailed Description

Definition at line 45 of file InternalStorageStatsDataWrapper.h.

Constructor & Destructor Documentation

foreign_storage::InternalStorageStatsDataWrapper::InternalStorageStatsDataWrapper ( )
foreign_storage::InternalStorageStatsDataWrapper::InternalStorageStatsDataWrapper ( const int  db_id,
const ForeignTable foreign_table 
)

Member Function Documentation

void foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable ( const std::string &  table_name)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 118 of file InternalStorageStatsDataWrapper.cpp.

References CHECK, CHECK_EQ, Catalog_Namespace::SysCatalog::getDataMgr(), Data_Namespace::DataMgr::getGlobalFileMgr(), INFORMATION_SCHEMA_DB, Catalog_Namespace::SysCatalog::instance(), foreign_storage::InternalSystemDataWrapper::row_count_, storage_details_, and Catalog_Namespace::STORAGE_DETAILS_SYS_TABLE_NAME.

119  {
121  storage_details_.clear();
122  const auto global_file_mgr =
124  CHECK(global_file_mgr);
125  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
126  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
127  if (catalog->name() != INFORMATION_SCHEMA_DB) {
128  for (const auto& [table_id, shard_id] :
129  catalog->getAllPersistedTableAndShardIds()) {
130  uint64_t total_dictionary_file_size{0};
131  auto logical_table_id = catalog->getLogicalTableId(table_id);
132  for (const auto& dict_path :
133  catalog->getTableDictDirectoryPaths(logical_table_id)) {
134  CHECK(std::filesystem::is_directory(dict_path));
135  for (const auto& file_entry : std::filesystem::directory_iterator(dict_path)) {
136  CHECK(file_entry.is_regular_file());
137  total_dictionary_file_size += static_cast<uint64_t>(file_entry.file_size());
138  }
139  }
140  auto db_id = catalog->getDatabaseId();
141  storage_details_.emplace_back(db_id,
142  logical_table_id,
143  shard_id,
144  total_dictionary_file_size,
145  global_file_mgr->getStorageStats(db_id, table_id));
146  }
147  }
148  }
149  row_count_ = storage_details_.size();
150 }
#define CHECK_EQ(x, y)
Definition: Logger.h:219
Data_Namespace::DataMgr & getDataMgr() const
Definition: SysCatalog.h:217
static SysCatalog & instance()
Definition: SysCatalog.h:326
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:616
static constexpr const char * STORAGE_DETAILS_SYS_TABLE_NAME
Definition: Catalog.h:106
#define CHECK(condition)
Definition: Logger.h:211
const std::string INFORMATION_SCHEMA_DB
Definition: SysCatalog.h:65

+ Here is the call graph for this function:

void foreign_storage::InternalStorageStatsDataWrapper::populateChunkBuffersForTable ( const std::string &  table_name,
std::map< std::string, import_export::TypedImportBuffer * > &  import_buffers 
)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 152 of file InternalStorageStatsDataWrapper.cpp.

References CHECK_EQ, foreign_storage::anonymous_namespace{InternalStorageStatsDataWrapper.cpp}::populate_import_buffers_for_storage_details(), storage_details_, and Catalog_Namespace::STORAGE_DETAILS_SYS_TABLE_NAME.

154  {
157 }
#define CHECK_EQ(x, y)
Definition: Logger.h:219
void populate_import_buffers_for_storage_details(const std::vector< StorageDetails > &storage_details, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static constexpr const char * STORAGE_DETAILS_SYS_TABLE_NAME
Definition: Catalog.h:106

+ Here is the call graph for this function:

Member Data Documentation

std::vector<StorageDetails> foreign_storage::InternalStorageStatsDataWrapper::storage_details_
private

The documentation for this class was generated from the following files: