OmniSciDB  72c90bc290
 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, AbstractBuffer *delete_buffer) 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 const std::set
< std::string > 
getAlterableTableOptions () const
 
virtual void validateSchema (const std::list< ColumnDescriptor > &columns) const
 
virtual ParallelismLevel getCachedParallelismLevel () const
 
virtual ParallelismLevel getNonCachedParallelismLevel () const
 
virtual bool isLazyFragmentFetchingEnabled () 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 124 of file InternalStorageStatsDataWrapper.cpp.

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

125  {
127  storage_details_.clear();
128  const auto global_file_mgr =
130  CHECK(global_file_mgr);
131  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
132  for (const auto& catalog : sys_catalog.getCatalogsForAllDbs()) {
133  if (catalog->name() != shared::kInfoSchemaDbName) {
134  std::set<std::string> found_dict_paths;
135  for (const auto& [table_id, shard_id] :
136  catalog->getAllPersistedTableAndShardIds()) {
137  uint64_t total_dictionary_file_size{0};
138  auto logical_table_id = catalog->getLogicalTableId(table_id);
139  for (const auto& dict_path :
140  catalog->getTableDictDirectoryPaths(logical_table_id)) {
141  if (found_dict_paths.find(dict_path) == found_dict_paths.end()) {
142  found_dict_paths.emplace(dict_path);
143  } else {
144  // Skip shared dictionaries.
145  continue;
146  }
147  CHECK(std::filesystem::is_directory(dict_path));
148  for (const auto& file_entry : std::filesystem::directory_iterator(dict_path)) {
149  CHECK(file_entry.is_regular_file());
150  total_dictionary_file_size += static_cast<uint64_t>(file_entry.file_size());
151  }
152  }
153  auto db_id = catalog->getDatabaseId();
154  storage_details_.emplace_back(db_id,
155  logical_table_id,
156  shard_id,
157  total_dictionary_file_size,
158  global_file_mgr->getStorageStats(db_id, table_id));
159  }
160  }
161  }
162  row_count_ = storage_details_.size();
163 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
const std::string kInfoSchemaDbName
Data_Namespace::DataMgr & getDataMgr() const
Definition: SysCatalog.h:234
static SysCatalog & instance()
Definition: SysCatalog.h:343
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:649
static constexpr const char * STORAGE_DETAILS_SYS_TABLE_NAME
Definition: Catalog.h:121
#define CHECK(condition)
Definition: Logger.h:291

+ 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 165 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.

167  {
170 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
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:121

+ 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: