OmniSciDB  a987f07e93
 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 void createRenderGroupAnalyzers ()
 Create RenderGroupAnalyzers for poly columns. More...
 
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 123 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.

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

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

166  {
169 }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
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:113

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