OmniSciDB
a5dc49c757
|
#include <CachingForeignStorageMgr.h>
Public Member Functions | |
CachingForeignStorageMgr (ForeignStorageCache *cache) | |
void | fetchBuffer (const ChunkKey &chunk_key, AbstractBuffer *destination_buffer, const size_t num_bytes) override |
void | getChunkMetadataVecForKeyPrefix (ChunkMetadataVector &chunk_metadata, const ChunkKey &chunk_key_prefix) override |
void | getChunkMetadataVecFromDataWrapper (ChunkMetadataVector &chunk_metadata, const ChunkKey &chunk_key_prefix) |
void | removeTableRelatedDS (const int db_id, const int table_id) override |
void | refreshTable (const ChunkKey &table_key, const bool evict_cached_entries) override |
bool | createDataWrapperIfNotExists (const ChunkKey &chunk_key) override |
bool | hasStoredDataWrapper (int32_t db, int32_t tb) const |
Public Member Functions inherited from foreign_storage::ForeignStorageMgr | |
ForeignStorageMgr () | |
~ForeignStorageMgr () override | |
AbstractBuffer * | createBuffer (const ChunkKey &chunk_key, const size_t page_size, const size_t initial_size) override |
void | deleteBuffer (const ChunkKey &chunk_key, const bool purge) override |
void | deleteBuffersWithPrefix (const ChunkKey &chunk_key_prefix, const bool purge) override |
AbstractBuffer * | getBuffer (const ChunkKey &chunk_key, const size_t num_bytes) override |
void | fetchBuffer (const ChunkKey &chunk_key, AbstractBuffer *destination_buffer, const size_t num_bytes) override |
AbstractBuffer * | putBuffer (const ChunkKey &chunk_key, AbstractBuffer *source_buffer, const size_t num_bytes) override |
void | getChunkMetadataVecForKeyPrefix (ChunkMetadataVector &chunk_metadata, const ChunkKey &chunk_key_prefix) override |
bool | isBufferOnDevice (const ChunkKey &chunk_key) override |
std::string | printSlabs () override |
size_t | getMaxSize () override |
size_t | getInUseSize () override |
size_t | getAllocated () override |
bool | isAllocationCapped () override |
void | checkpoint () override |
void | checkpoint (const int db_id, const int tb_id) override |
AbstractBuffer * | alloc (const size_t num_bytes) override |
void | free (AbstractBuffer *buffer) override |
MgrType | getMgrType () override |
std::string | getStringMgrType () override |
size_t | getNumChunks () override |
void | removeTableRelatedDS (const int db_id, const int table_id) override |
bool | hasDataWrapperForChunk (const ChunkKey &chunk_key) const |
bool | isDatawrapperRestored (const ChunkKey &chunk_key) |
void | setDataWrapper (const ChunkKey &table_key, std::shared_ptr< MockForeignDataWrapper > data_wrapper) |
std::shared_ptr < ForeignDataWrapper > | getDataWrapper (const ChunkKey &chunk_key) const |
void | setParallelismHints (const std::map< ChunkKey, std::set< ParallelismHint >> &hints_per_table) |
Private Member Functions | |
void | refreshTableInCache (const ChunkKey &table_key) |
int | getHighestCachedFragId (const ChunkKey &table_key) |
void | refreshAppendTableInCache (const ChunkKey &table_key, const std::vector< ChunkKey > &old_chunk_keys) |
void | refreshNonAppendTableInCache (const ChunkKey &table_key, const std::vector< ChunkKey > &old_chunk_keys) |
void | refreshChunksInCacheByFragment (const std::vector< ChunkKey > &old_chunk_keys, int last_frag_id) |
void | populateChunkBuffersSafely (ForeignDataWrapper &data_wrapper, ChunkToBufferMap &required_buffers, ChunkToBufferMap &optional_buffers) |
void | eraseDataWrapper (const ChunkKey &key) override |
void | clearTable (const ChunkKey &table_key) |
size_t | maxFetchSize (int32_t db_id) const override |
bool | hasMaxFetchSize () const override |
std::set< ChunkKey > | getOptionalKeysWithinSizeLimit (const ChunkKey &chunk_key, const std::set< ChunkKey, decltype(set_comp)* > &same_fragment_keys, const std::set< ChunkKey, decltype(set_comp)* > &diff_fragment_keys) const override |
bool | isChunkCached (const ChunkKey &chunk_key) const override |
void | evictChunkFromCache (const ChunkKey &chunk_key) override |
size_t | getBufferSize (const ChunkKey &key) const |
size_t | getRequiredBuffersSize (const ChunkKey &chunk_key) const |
Private Attributes | |
ForeignStorageCache * | disk_cache_ |
Additional Inherited Members | |
Public Types inherited from foreign_storage::ForeignStorageMgr | |
using | ParallelismHint = std::pair< int, int > |
Protected Member Functions inherited from foreign_storage::ForeignStorageMgr | |
void | updateFragmenterMetadata (const ChunkToBufferMap &) const |
void | createDataWrapperUnlocked (int32_t db, int32_t tb) |
bool | fetchBufferIfTempBufferMapEntryExists (const ChunkKey &chunk_key, AbstractBuffer *destination_buffer, const size_t num_bytes) |
ChunkToBufferMap | allocateTempBuffersForChunks (const std::set< ChunkKey > &chunk_keys) |
void | clearTempChunkBufferMapEntriesForTable (const ChunkKey &table_key) |
void | clearTempChunkBufferMapEntriesForTableUnlocked (const ChunkKey &table_key) |
std::set< ChunkKey > | getOptionalChunkKeySetAndNormalizeCache (const ChunkKey &chunk_key, const std::set< ChunkKey > &required_chunk_keys, const ForeignDataWrapper::ParallelismLevel parallelism_level) |
std::pair< std::set< ChunkKey, decltype(set_comp)* > , std::set< ChunkKey, decltype(set_comp)* > > | getPrefetchSets (const ChunkKey &chunk_key, const std::set< ChunkKey > &required_chunk_keys, const ForeignDataWrapper::ParallelismLevel parallelism_level) const |
Static Protected Member Functions inherited from foreign_storage::ForeignStorageMgr | |
static void | checkIfS3NeedsToBeEnabled (const ChunkKey &chunk_key) |
Protected Attributes inherited from foreign_storage::ForeignStorageMgr | |
std::shared_mutex | data_wrapper_mutex_ |
std::map< ChunkKey, std::shared_ptr < ForeignDataWrapper > > | data_wrapper_map_ |
std::map< ChunkKey, std::shared_ptr < MockForeignDataWrapper > > | mocked_wrapper_map_ |
std::map< ChunkKey, std::unique_ptr < AbstractBuffer > > | temp_chunk_buffer_map_ |
std::shared_mutex | temp_chunk_buffer_map_mutex_ |
std::shared_mutex | parallelism_hints_mutex_ |
std::map< ChunkKey, std::set < ParallelismHint > > | parallelism_hints_per_table_ |
Definition at line 27 of file CachingForeignStorageMgr.h.
foreign_storage::CachingForeignStorageMgr::CachingForeignStorageMgr | ( | ForeignStorageCache * | cache | ) |
Definition at line 38 of file CachingForeignStorageMgr.cpp.
References CHECK, and disk_cache_.
|
private |
Definition at line 265 of file CachingForeignStorageMgr.cpp.
References CHECK, foreign_storage::ForeignStorageCache::clearForTablePrefix(), disk_cache_, foreign_storage::ForeignStorageMgr::eraseDataWrapper(), and foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix().
Referenced by getChunkMetadataVecForKeyPrefix(), getChunkMetadataVecFromDataWrapper(), refreshNonAppendTableInCache(), and refreshTable().
|
overridevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 379 of file CachingForeignStorageMgr.cpp.
References foreign_storage::ForeignStorageMgr::createDataWrapperUnlocked(), foreign_storage::ForeignStorageMgr::data_wrapper_map_, foreign_storage::ForeignStorageMgr::data_wrapper_mutex_, disk_cache_, shared::get_from_map(), get_table_key(), get_table_prefix(), foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix(), and foreign_storage::ForeignStorageCache::getSerializedWrapperPath().
Referenced by getChunkMetadataVecForKeyPrefix().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 253 of file CachingForeignStorageMgr.cpp.
References CHECK, foreign_storage::ForeignStorageMgr::data_wrapper_map_, foreign_storage::ForeignStorageMgr::data_wrapper_mutex_, disk_cache_, get_table_prefix(), foreign_storage::ForeignStorageCache::getSerializedWrapperPath(), and is_table_key().
Referenced by getChunkMetadataVecForKeyPrefix(), and removeTableRelatedDS().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 478 of file CachingForeignStorageMgr.cpp.
References disk_cache_, and foreign_storage::ForeignStorageCache::eraseChunk().
|
override |
Definition at line 83 of file CachingForeignStorageMgr.cpp.
References CHECK, CHUNK_KEY_DB_IDX, Data_Namespace::AbstractBuffer::copyTo(), disk_cache_, foreign_storage::ForeignStorageCache::eraseChunk(), foreign_storage::ForeignStorageMgr::fetchBuffer(), foreign_storage::get_column_key_set(), foreign_storage::ForeignStorageCache::getCachedChunkIfExists(), foreign_storage::ForeignStorageCache::getChunkBuffersForCaching(), foreign_storage::ForeignStorageMgr::getDataWrapper(), foreign_storage::ForeignStorageMgr::getOptionalChunkKeySetAndNormalizeCache(), getRequiredBuffersSize(), foreign_storage::anonymous_namespace{CachingForeignStorageMgr.cpp}::is_in_memory_system_table_chunk_key(), Data_Namespace::AbstractBuffer::isDirty(), maxFetchSize(), populateChunkBuffersSafely(), and foreign_storage::ChunkSizeValidator::validateChunkSize().
|
private |
Definition at line 453 of file CachingForeignStorageMgr.cpp.
References CHECK_EQ, disk_cache_, get_fragment_key(), foreign_storage::get_max_chunk_size(), foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix(), is_varlen_data_key(), is_varlen_key(), and show_chunk().
Referenced by getOptionalKeysWithinSizeLimit(), and getRequiredBuffersSize().
|
override |
Definition at line 138 of file CachingForeignStorageMgr.cpp.
References foreign_storage::ForeignStorageCache::cacheMetadataVec(), CHECK, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, clearTable(), createDataWrapperIfNotExists(), disk_cache_, eraseDataWrapper(), logger::ERROR, foreign_storage::fragment_maps_to_leaf(), get_table_key(), get_table_prefix(), foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix(), foreign_storage::ForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), getChunkMetadataVecFromDataWrapper(), has_table_prefix(), foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix(), foreign_storage::ForeignStorageCache::hasStoredDataWrapperMetadata(), dist::is_distributed(), foreign_storage::anonymous_namespace{CachingForeignStorageMgr.cpp}::is_in_memory_system_table_chunk_key(), foreign_storage::is_shardable_key(), LOG, and show_chunk().
void foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecFromDataWrapper | ( | ChunkMetadataVector & | chunk_metadata, |
const ChunkKey & | chunk_key_prefix | ||
) |
Definition at line 196 of file CachingForeignStorageMgr.cpp.
References CHECK, foreign_storage::ForeignStorageCache::checkpoint(), clearTable(), disk_cache_, get_table_prefix(), foreign_storage::ForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), foreign_storage::ForeignStorageMgr::getDataWrapper(), has_table_prefix(), foreign_storage::is_table_enabled_on_node(), and foreign_storage::ForeignStorageCache::storeDataWrapper().
Referenced by getChunkMetadataVecForKeyPrefix(), refreshAppendTableInCache(), and refreshNonAppendTableInCache().
|
private |
Definition at line 271 of file CachingForeignStorageMgr.cpp.
References CHUNK_KEY_FRAGMENT_IDX, disk_cache_, foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix(), and foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix().
Referenced by refreshAppendTableInCache().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 426 of file CachingForeignStorageMgr.cpp.
References CHUNK_KEY_DB_IDX, foreign_storage::get_column_key_set(), getBufferSize(), getRequiredBuffersSize(), and maxFetchSize().
|
private |
Definition at line 417 of file CachingForeignStorageMgr.cpp.
References foreign_storage::get_column_key_set(), and getBufferSize().
Referenced by fetchBuffer(), and getOptionalKeysWithinSizeLimit().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 413 of file CachingForeignStorageMgr.cpp.
bool foreign_storage::CachingForeignStorageMgr::hasStoredDataWrapper | ( | int32_t | db, |
int32_t | tb | ||
) | const |
Definition at line 229 of file CachingForeignStorageMgr.cpp.
References disk_cache_, and foreign_storage::ForeignStorageCache::hasStoredDataWrapperMetadata().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 474 of file CachingForeignStorageMgr.cpp.
References disk_cache_, and foreign_storage::ForeignStorageCache::getCachedChunkIfExists().
|
overrideprivatevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 409 of file CachingForeignStorageMgr.cpp.
References disk_cache_, and foreign_storage::ForeignStorageCache::getMaxChunkDataSize().
Referenced by fetchBuffer(), and getOptionalKeysWithinSizeLimit().
|
private |
Definition at line 43 of file CachingForeignStorageMgr.cpp.
References CHECK_GT, foreign_storage::ForeignStorageCache::checkpoint(), disk_cache_, get_table_prefix(), foreign_storage::ForeignDataWrapper::populateChunkBuffers(), and foreign_storage::ForeignStorageMgr::updateFragmenterMetadata().
Referenced by fetchBuffer(), and refreshChunksInCacheByFragment().
|
private |
Definition at line 284 of file CachingForeignStorageMgr.cpp.
References foreign_storage::ForeignStorageCache::cacheMetadataVec(), CHECK, disk_cache_, getChunkMetadataVecFromDataWrapper(), getHighestCachedFragId(), is_table_key(), and refreshChunksInCacheByFragment().
Referenced by refreshTableInCache().
|
private |
Definition at line 316 of file CachingForeignStorageMgr.cpp.
References CHECK, CHUNK_KEY_FRAGMENT_IDX, CHUNK_KEY_TABLE_IDX, disk_cache_, foreign_storage::get_column_key_set(), get_table_key(), foreign_storage::ForeignStorageCache::getCachedChunkIfExists(), foreign_storage::ForeignStorageCache::getChunkBuffersForCaching(), foreign_storage::ForeignStorageMgr::getDataWrapper(), foreign_storage::ForeignStorageCache::isMetadataCached(), LOG, foreign_storage::anonymous_namespace{CachingForeignStorageMgr.cpp}::MAX_REFRESH_TIME_IN_SECONDS, populateChunkBuffersSafely(), and logger::WARNING.
Referenced by refreshAppendTableInCache(), and refreshNonAppendTableInCache().
|
private |
Definition at line 300 of file CachingForeignStorageMgr.cpp.
References foreign_storage::ForeignStorageCache::cacheMetadataVec(), CHECK, clearTable(), disk_cache_, getChunkMetadataVecFromDataWrapper(), is_table_key(), and refreshChunksInCacheByFragment().
Referenced by refreshTableInCache().
|
overridevirtual |
Reimplemented from foreign_storage::ForeignStorageMgr.
Definition at line 217 of file CachingForeignStorageMgr.cpp.
References CHECK, foreign_storage::ForeignStorageMgr::checkIfS3NeedsToBeEnabled(), clearTable(), foreign_storage::ForeignStorageMgr::clearTempChunkBufferMapEntriesForTable(), is_table_key(), and refreshTableInCache().
|
private |
Definition at line 233 of file CachingForeignStorageMgr.cpp.
References CHECK, disk_cache_, foreign_storage::fragment_maps_to_leaf(), foreign_storage::ForeignStorageCache::getCachedChunksForKeyPrefix(), foreign_storage::is_append_table_chunk_key(), foreign_storage::is_shardable_key(), is_table_key(), refreshAppendTableInCache(), refreshNonAppendTableInCache(), and show_chunk().
Referenced by refreshTable().
|
override |
Definition at line 403 of file CachingForeignStorageMgr.cpp.
References foreign_storage::ForeignStorageCache::clearForTablePrefix(), disk_cache_, eraseDataWrapper(), and foreign_storage::ForeignStorageMgr::removeTableRelatedDS().
|
private |
Definition at line 88 of file CachingForeignStorageMgr.h.
Referenced by CachingForeignStorageMgr(), clearTable(), createDataWrapperIfNotExists(), eraseDataWrapper(), evictChunkFromCache(), fetchBuffer(), getBufferSize(), getChunkMetadataVecForKeyPrefix(), getChunkMetadataVecFromDataWrapper(), getHighestCachedFragId(), hasStoredDataWrapper(), isChunkCached(), maxFetchSize(), populateChunkBuffersSafely(), refreshAppendTableInCache(), refreshChunksInCacheByFragment(), refreshNonAppendTableInCache(), refreshTableInCache(), and removeTableRelatedDS().