OmniSciDB
bf83d84833
|
#include <ForeignStorageCache.h>
Private Member Functions | |
std::set< ChunkKey >::iterator | eraseChunk (const std::set< ChunkKey >::iterator &) |
void | eraseChunk (const ChunkKey &chunk_key) |
std::set< ChunkKey >::iterator | evictChunkByIterator (const std::set< ChunkKey >::iterator &chunk_it) |
void | evictThenEraseChunkUnlocked (const ChunkKey &) |
void | validatePath (const std::string &) const |
Private Attributes | |
std::unique_ptr < File_Namespace::GlobalFileMgr > | global_file_mgr_ |
std::set< ChunkKey > | cached_chunks_ |
std::set< ChunkKey > | cached_metadata_ |
size_t | num_chunks_added_ |
size_t | num_metadata_added_ |
mapd_shared_mutex | chunks_mutex_ |
mapd_shared_mutex | metadata_mutex_ |
Definition at line 58 of file ForeignStorageCache.h.
foreign_storage::ForeignStorageCache::ForeignStorageCache | ( | const DiskCacheConfig & | config | ) |
Definition at line 54 of file ForeignStorageCache.cpp.
References global_file_mgr_, DiskCacheConfig::num_reader_threads, DiskCacheConfig::path, and validatePath().
void foreign_storage::ForeignStorageCache::cacheChunk | ( | const ChunkKey & | chunk_key, |
AbstractBuffer * | buffer | ||
) |
Definition at line 71 of file ForeignStorageCache.cpp.
References cached_chunks_, cached_metadata_, CHECK, chunks_mutex_, DEBUG_TIMER, global_file_mgr_, Data_Namespace::AbstractBuffer::isDirty(), metadata_mutex_, num_chunks_added_, and Data_Namespace::AbstractBuffer::setUpdated().
void foreign_storage::ForeignStorageCache::cacheMetadataVec | ( | const ChunkMetadataVector & | metadata_vec | ) |
Definition at line 168 of file ForeignStorageCache.cpp.
References cached_metadata_, CHECK, CHUNK_KEY_COLUMN_IDX, CHUNK_KEY_DB_IDX, CHUNK_KEY_FRAGMENT_IDX, CHUNK_KEY_TABLE_IDX, chunks_mutex_, DEBUG_TIMER, evictThenEraseChunkUnlocked(), Data_Namespace::AbstractBuffer::getEncoder(), Encoder::getMetadata(), global_file_mgr_, is_varlen_data_key(), is_varlen_key(), metadata_mutex_, num_metadata_added_, foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer(), and Data_Namespace::AbstractBuffer::setUpdated().
Referenced by cacheMetadataWithFragIdGreaterOrEqualTo(), and foreign_storage::CachingForeignStorageMgr::refreshNonAppendTableInCache().
void foreign_storage::ForeignStorageCache::cacheMetadataWithFragIdGreaterOrEqualTo | ( | const ChunkMetadataVector & | metadata_vec, |
const int | frag_id | ||
) |
Definition at line 401 of file ForeignStorageCache.cpp.
References cacheMetadataVec(), and CHUNK_KEY_FRAGMENT_IDX.
Referenced by foreign_storage::CachingForeignStorageMgr::refreshAppendTableInCache().
void foreign_storage::ForeignStorageCache::cacheTableChunks | ( | const std::vector< ChunkKey > & | chunk_keys | ) |
Caches the chunks for the given chunk keys. Chunk buffers for chunks to be cached are expected to have already been populated before calling this method. This method also expects all provided chunk keys to be for the same table.
chunk_keys | - keys of chunks to be cached |
Definition at line 86 of file ForeignStorageCache.cpp.
References cached_chunks_, CHECK, CHECK_EQ, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, chunks_mutex_, DEBUG_TIMER, global_file_mgr_, and num_chunks_added_.
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
void foreign_storage::ForeignStorageCache::clear | ( | ) |
Definition at line 284 of file ForeignStorageCache.cpp.
References cached_chunks_, cached_metadata_, chunks_mutex_, DEBUG_TIMER, evictChunkByIterator(), global_file_mgr_, and metadata_mutex_.
void foreign_storage::ForeignStorageCache::clearForTablePrefix | ( | const ChunkKey & | chunk_prefix | ) |
Definition at line 260 of file ForeignStorageCache.cpp.
References cached_chunks_, cached_metadata_, CHECK, chunks_mutex_, DEBUG_TIMER, evictChunkByIterator(), global_file_mgr_, is_table_key(), and metadata_mutex_.
Referenced by foreign_storage::CachingForeignStorageMgr::refreshNonAppendTableInCache(), and foreign_storage::CachingForeignStorageMgr::refreshTable().
void foreign_storage::ForeignStorageCache::deleteBufferIfExists | ( | const ChunkKey & | chunk_key | ) |
Definition at line 61 of file ForeignStorageCache.cpp.
References cached_chunks_, cached_metadata_, chunks_mutex_, global_file_mgr_, and metadata_mutex_.
std::string foreign_storage::ForeignStorageCache::dumpCachedChunkEntries | ( | ) | const |
Definition at line 354 of file ForeignStorageCache.cpp.
References cached_chunks_, DEBUG_TIMER, and show_chunk().
std::string foreign_storage::ForeignStorageCache::dumpCachedMetadataEntries | ( | ) | const |
Definition at line 363 of file ForeignStorageCache.cpp.
References cached_metadata_, DEBUG_TIMER, and show_chunk().
|
private |
Definition at line 334 of file ForeignStorageCache.cpp.
References cached_chunks_, DEBUG_TIMER, File_Namespace::FileBuffer::freeChunkPages(), and global_file_mgr_.
|
private |
Definition at line 345 of file ForeignStorageCache.cpp.
References cached_chunks_, DEBUG_TIMER, File_Namespace::FileBuffer::freeChunkPages(), and global_file_mgr_.
Referenced by clear(), and clearForTablePrefix().
void foreign_storage::ForeignStorageCache::evictThenEraseChunk | ( | const ChunkKey & | chunk_key | ) |
Definition at line 158 of file ForeignStorageCache.cpp.
References chunks_mutex_, and evictThenEraseChunkUnlocked().
|
private |
Definition at line 163 of file ForeignStorageCache.cpp.
References eraseChunk(), and get_table_key().
Referenced by cacheMetadataVec(), and evictThenEraseChunk().
AbstractBuffer * foreign_storage::ForeignStorageCache::getCachedChunkIfExists | ( | const ChunkKey & | chunk_key | ) |
Definition at line 105 of file ForeignStorageCache.cpp.
References cached_chunks_, chunks_mutex_, DEBUG_TIMER, and global_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
std::vector< ChunkKey > foreign_storage::ForeignStorageCache::getCachedChunksForKeyPrefix | ( | const ChunkKey & | chunk_prefix | ) | const |
Definition at line 305 of file ForeignStorageCache.cpp.
References cached_chunks_, chunks_mutex_, and foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::iterate_over_matching_prefix().
Referenced by foreign_storage::CachingForeignStorageMgr::refreshTableInCache().
std::string foreign_storage::ForeignStorageCache::getCacheDirectoryForTablePrefix | ( | const ChunkKey & | table_prefix | ) | const |
Definition at line 392 of file ForeignStorageCache.cpp.
References CHECK, File_Namespace::GlobalFileMgr::getFileMgr(), and getGlobalFileMgr().
Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::recoverDataWrapperFromDisk().
void foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix | ( | ChunkMetadataVector & | metadata_vec, |
const ChunkKey & | chunk_prefix | ||
) | const |
Definition at line 229 of file ForeignStorageCache.cpp.
References cached_metadata_, DEBUG_TIMER, global_file_mgr_, foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::iterate_over_matching_prefix(), and metadata_mutex_.
Referenced by foreign_storage::CachingForeignStorageMgr::createOrRecoverDataWrapperIfNotExists(), and foreign_storage::CachingForeignStorageMgr::getHighestCachedFragId().
AbstractBuffer * foreign_storage::ForeignStorageCache::getChunkBufferForPrecaching | ( | const ChunkKey & | chunk_key, |
bool | is_new_buffer | ||
) |
Definition at line 414 of file ForeignStorageCache.cpp.
References CHECK, File_Namespace::GlobalFileMgr::createBuffer(), File_Namespace::GlobalFileMgr::getBuffer(), and getGlobalFileMgr().
std::map< ChunkKey, AbstractBuffer * > foreign_storage::ForeignStorageCache::getChunkBuffersForCaching | ( | const std::vector< ChunkKey > & | chunk_keys | ) | const |
Definition at line 314 of file ForeignStorageCache.cpp.
References cached_chunks_, CHECK, CHECK_EQ, chunks_mutex_, DEBUG_TIMER, and global_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
|
inline |
Definition at line 100 of file ForeignStorageCache.h.
Referenced by getCacheDirectoryForTablePrefix(), and getChunkBufferForPrecaching().
|
inline |
Definition at line 91 of file ForeignStorageCache.h.
|
inline |
Definition at line 92 of file ForeignStorageCache.h.
|
inline |
Definition at line 93 of file ForeignStorageCache.h.
|
inline |
Definition at line 94 of file ForeignStorageCache.h.
bool foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix | ( | const ChunkKey & | chunk_prefix | ) | const |
Definition at line 244 of file ForeignStorageCache.cpp.
References cached_metadata_, DEBUG_TIMER, and metadata_mutex_.
Referenced by foreign_storage::CachingForeignStorageMgr::createOrRecoverDataWrapperIfNotExists(), foreign_storage::CachingForeignStorageMgr::getHighestCachedFragId(), and foreign_storage::CachingForeignStorageMgr::refreshTableInCache().
bool foreign_storage::ForeignStorageCache::isMetadataCached | ( | const ChunkKey & | chunk_key | ) | const |
Definition at line 118 of file ForeignStorageCache.cpp.
References cached_metadata_, DEBUG_TIMER, and metadata_mutex_.
Referenced by foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
bool foreign_storage::ForeignStorageCache::recoverCacheForTable | ( | ChunkMetadataVector & | meta_vec, |
const ChunkKey & | table_key | ||
) |
Definition at line 124 of file ForeignStorageCache.cpp.
References cached_chunks_, cached_metadata_, CHECK, CHUNK_KEY_COLUMN_IDX, CHUNK_KEY_DB_IDX, CHUNK_KEY_FRAGMENT_IDX, CHUNK_KEY_TABLE_IDX, chunks_mutex_, global_file_mgr_, is_table_key(), is_varlen_data_key(), and is_varlen_key().
Referenced by foreign_storage::CachingForeignStorageMgr::refreshTableInCache().
|
private |
Definition at line 372 of file ForeignStorageCache.cpp.
Referenced by ForeignStorageCache().
|
private |
Definition at line 122 of file ForeignStorageCache.h.
Referenced by cacheChunk(), cacheTableChunks(), clear(), clearForTablePrefix(), deleteBufferIfExists(), dumpCachedChunkEntries(), eraseChunk(), evictChunkByIterator(), getCachedChunkIfExists(), getCachedChunksForKeyPrefix(), getChunkBuffersForCaching(), and recoverCacheForTable().
|
private |
Definition at line 123 of file ForeignStorageCache.h.
Referenced by cacheChunk(), cacheMetadataVec(), clear(), clearForTablePrefix(), deleteBufferIfExists(), dumpCachedMetadataEntries(), getCachedMetadataVecForKeyPrefix(), hasCachedMetadataForKeyPrefix(), isMetadataCached(), and recoverCacheForTable().
|
mutableprivate |
Definition at line 130 of file ForeignStorageCache.h.
Referenced by cacheChunk(), cacheMetadataVec(), cacheTableChunks(), clear(), clearForTablePrefix(), deleteBufferIfExists(), evictThenEraseChunk(), getCachedChunkIfExists(), getCachedChunksForKeyPrefix(), getChunkBuffersForCaching(), and recoverCacheForTable().
|
private |
Definition at line 119 of file ForeignStorageCache.h.
Referenced by cacheChunk(), cacheMetadataVec(), cacheTableChunks(), clear(), clearForTablePrefix(), deleteBufferIfExists(), eraseChunk(), evictChunkByIterator(), ForeignStorageCache(), getCachedChunkIfExists(), getCachedMetadataVecForKeyPrefix(), getChunkBuffersForCaching(), and recoverCacheForTable().
|
mutableprivate |
Definition at line 131 of file ForeignStorageCache.h.
Referenced by cacheChunk(), cacheMetadataVec(), clear(), clearForTablePrefix(), deleteBufferIfExists(), getCachedMetadataVecForKeyPrefix(), hasCachedMetadataForKeyPrefix(), and isMetadataCached().
|
private |
Definition at line 126 of file ForeignStorageCache.h.
Referenced by cacheChunk(), and cacheTableChunks().
|
private |
Definition at line 127 of file ForeignStorageCache.h.
Referenced by cacheMetadataVec().