OmniSciDB
a5dc49c757
|
#include <ForeignStorageCache.h>
Public Member Functions | |
ForeignStorageCache (const File_Namespace::DiskCacheConfig &config) | |
void | checkpoint (const int32_t db_id, const int32_t tb_id) |
void | putBuffer (const ChunkKey &, AbstractBuffer *, const size_t numBytes=0) |
File_Namespace::FileBuffer * | getCachedChunkIfExists (const ChunkKey &) |
bool | isMetadataCached (const ChunkKey &) const |
void | cacheMetadataVec (const ChunkMetadataVector &) |
void | getCachedMetadataVecForKeyPrefix (ChunkMetadataVector &, const ChunkKey &) const |
bool | hasCachedMetadataForKeyPrefix (const ChunkKey &) const |
void | clearForTablePrefix (const ChunkKey &) |
void | clear () |
size_t | getMaxChunkDataSize () const |
std::vector< ChunkKey > | getCachedChunksForKeyPrefix (const ChunkKey &) const |
ChunkToBufferMap | getChunkBuffersForCaching (const std::set< ChunkKey > &chunk_keys) const |
AbstractBuffer * | getChunkBufferForPrecaching (const ChunkKey &chunk_key, bool is_new_buffer) |
void | deleteBufferIfExists (const ChunkKey &chunk_key) |
size_t | getNumCachedChunks () const |
size_t | getNumCachedMetadata () const |
std::string | dumpCachedChunkEntries () const |
std::string | dumpCachedMetadataEntries () const |
std::string | dumpEvictionQueue () const |
std::string | dump () const |
std::string | getCacheDirectory () const |
std::string | getCacheDirectoryForTable (int db_id, int tb_id) const |
std::string | getSerializedWrapperPath (int32_t db_id, int32_t tb_id) const |
uint64_t | getSpaceReservedByTable (int db_id, int tb_id) const |
void | storeDataWrapper (const std::string &doc, int32_t db_id, int32_t tb_id) |
bool | hasStoredDataWrapperMetadata (int32_t db_id, int32_t table_id) const |
void | eraseChunk (const ChunkKey &chunk_key) |
void | setDataSizeLimit (size_t max) const |
Private Member Functions | |
void | validatePath (const std::string &) const |
Private Attributes | |
std::unique_ptr < File_Namespace::CachingFileMgr > | caching_file_mgr_ |
Definition at line 42 of file ForeignStorageCache.h.
foreign_storage::ForeignStorageCache::ForeignStorageCache | ( | const File_Namespace::DiskCacheConfig & | config | ) |
Definition at line 52 of file ForeignStorageCache.cpp.
References caching_file_mgr_, File_Namespace::DiskCacheConfig::path, and validatePath().
void foreign_storage::ForeignStorageCache::cacheMetadataVec | ( | const ChunkMetadataVector & | metadata_vec | ) |
Definition at line 109 of file ForeignStorageCache.cpp.
References caching_file_mgr_, CHECK, CHUNK_KEY_COLUMN_IDX, CHUNK_KEY_DB_IDX, CHUNK_KEY_FRAGMENT_IDX, CHUNK_KEY_TABLE_IDX, DEBUG_TIMER, eraseChunk(), Data_Namespace::AbstractBuffer::getEncoder(), Encoder::getMetadata(), in_same_table(), is_varlen_data_key(), is_varlen_key(), foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer(), and Data_Namespace::AbstractBuffer::setUpdated().
Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), File_Namespace::CachingGlobalFileMgr::getChunkMetadataVecForKeyPrefix(), foreign_storage::CachingForeignStorageMgr::refreshAppendTableInCache(), and foreign_storage::CachingForeignStorageMgr::refreshNonAppendTableInCache().
void foreign_storage::ForeignStorageCache::checkpoint | ( | const int32_t | db_id, |
const int32_t | tb_id | ||
) |
Definition at line 68 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by File_Namespace::CachingGlobalFileMgr::checkpoint(), foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecFromDataWrapper(), and foreign_storage::CachingForeignStorageMgr::populateChunkBuffersSafely().
void foreign_storage::ForeignStorageCache::clear | ( | ) |
Definition at line 190 of file ForeignStorageCache.cpp.
References caching_file_mgr_, and DEBUG_TIMER.
void foreign_storage::ForeignStorageCache::clearForTablePrefix | ( | const ChunkKey & | chunk_prefix | ) |
Definition at line 183 of file ForeignStorageCache.cpp.
References caching_file_mgr_, CHECK, CHUNK_KEY_DB_IDX, CHUNK_KEY_TABLE_IDX, DEBUG_TIMER, and is_table_key().
Referenced by Catalog_Namespace::anonymous_namespace{Catalog.cpp}::clear_cached_table_data(), foreign_storage::CachingForeignStorageMgr::clearTable(), File_Namespace::CachingGlobalFileMgr::deleteBuffersWithPrefix(), File_Namespace::CachingGlobalFileMgr::removeCachedData(), and foreign_storage::CachingForeignStorageMgr::removeTableRelatedDS().
void foreign_storage::ForeignStorageCache::deleteBufferIfExists | ( | const ChunkKey & | chunk_key | ) |
Definition at line 57 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by File_Namespace::CachingGlobalFileMgr::deleteBuffer().
|
inline |
Definition at line 77 of file ForeignStorageCache.h.
std::string foreign_storage::ForeignStorageCache::dumpCachedChunkEntries | ( | ) | const |
Definition at line 208 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
std::string foreign_storage::ForeignStorageCache::dumpCachedMetadataEntries | ( | ) | const |
Definition at line 212 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
std::string foreign_storage::ForeignStorageCache::dumpEvictionQueue | ( | ) | const |
Definition at line 216 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
void foreign_storage::ForeignStorageCache::eraseChunk | ( | const ChunkKey & | chunk_key | ) |
Definition at line 204 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by cacheMetadataVec(), foreign_storage::CachingForeignStorageMgr::evictChunkFromCache(), and foreign_storage::CachingForeignStorageMgr::fetchBuffer().
File_Namespace::FileBuffer * foreign_storage::ForeignStorageCache::getCachedChunkIfExists | ( | const ChunkKey & | chunk_key | ) |
Definition at line 72 of file ForeignStorageCache.cpp.
References caching_file_mgr_, CHUNK_KEY_VARLEN_IDX, and is_varlen_data_key().
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), File_Namespace::CachingGlobalFileMgr::fetchBuffer(), foreign_storage::CachingForeignStorageMgr::isChunkCached(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
std::vector< ChunkKey > foreign_storage::ForeignStorageCache::getCachedChunksForKeyPrefix | ( | const ChunkKey & | chunk_prefix | ) | const |
Definition at line 199 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::refreshTableInCache().
|
inline |
Definition at line 79 of file ForeignStorageCache.h.
|
inline |
Definition at line 83 of file ForeignStorageCache.h.
void foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix | ( | ChunkMetadataVector & | metadata_vec, |
const ChunkKey & | chunk_prefix | ||
) | const |
Definition at line 172 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::createDataWrapperIfNotExists(), foreign_storage::CachingForeignStorageMgr::getBufferSize(), foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), File_Namespace::CachingGlobalFileMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::getHighestCachedFragId().
AbstractBuffer * foreign_storage::ForeignStorageCache::getChunkBufferForPrecaching | ( | const ChunkKey & | chunk_key, |
bool | is_new_buffer | ||
) |
Definition at line 256 of file ForeignStorageCache.cpp.
References caching_file_mgr_, and CHECK.
ChunkToBufferMap foreign_storage::ForeignStorageCache::getChunkBuffersForCaching | ( | const std::set< ChunkKey > & | chunk_keys | ) | const |
Definition at line 240 of file ForeignStorageCache.cpp.
References caching_file_mgr_, and CHECK.
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
|
inline |
Definition at line 55 of file ForeignStorageCache.h.
Referenced by foreign_storage::CachingForeignStorageMgr::maxFetchSize().
|
inline |
Definition at line 66 of file ForeignStorageCache.h.
|
inline |
Definition at line 69 of file ForeignStorageCache.h.
|
inline |
Definition at line 87 of file ForeignStorageCache.h.
References File_Namespace::CachingFileMgr::WRAPPER_FILE_NAME.
Referenced by foreign_storage::CachingForeignStorageMgr::createDataWrapperIfNotExists(), and foreign_storage::CachingForeignStorageMgr::eraseDataWrapper().
|
inline |
Definition at line 92 of file ForeignStorageCache.h.
bool foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix | ( | const ChunkKey & | chunk_prefix | ) | const |
Definition at line 178 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::clearTable(), foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), File_Namespace::CachingGlobalFileMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::getHighestCachedFragId().
bool foreign_storage::ForeignStorageCache::hasStoredDataWrapperMetadata | ( | int32_t | db_id, |
int32_t | table_id | ||
) | const |
Definition at line 274 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::hasStoredDataWrapper().
bool foreign_storage::ForeignStorageCache::isMetadataCached | ( | const ChunkKey & | chunk_key | ) | const |
Definition at line 101 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().
void foreign_storage::ForeignStorageCache::putBuffer | ( | const ChunkKey & | key, |
AbstractBuffer * | buf, | ||
const size_t | numBytes = 0 |
||
) |
Definition at line 61 of file ForeignStorageCache.cpp.
References caching_file_mgr_, CHECK, and Data_Namespace::AbstractBuffer::isDirty().
Referenced by File_Namespace::CachingGlobalFileMgr::checkpoint(), File_Namespace::CachingGlobalFileMgr::fetchBuffer(), and File_Namespace::CachingGlobalFileMgr::putBuffer().
|
inline |
Definition at line 103 of file ForeignStorageCache.h.
void foreign_storage::ForeignStorageCache::storeDataWrapper | ( | const std::string & | doc, |
int32_t | db_id, | ||
int32_t | tb_id | ||
) |
Definition at line 268 of file ForeignStorageCache.cpp.
References caching_file_mgr_.
Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecFromDataWrapper().
|
private |
Definition at line 220 of file ForeignStorageCache.cpp.
Referenced by ForeignStorageCache().
|
private |
Definition at line 111 of file ForeignStorageCache.h.
Referenced by cacheMetadataVec(), checkpoint(), clear(), clearForTablePrefix(), deleteBufferIfExists(), dumpCachedChunkEntries(), dumpCachedMetadataEntries(), dumpEvictionQueue(), eraseChunk(), ForeignStorageCache(), getCachedChunkIfExists(), getCachedChunksForKeyPrefix(), getCachedMetadataVecForKeyPrefix(), getChunkBufferForPrecaching(), getChunkBuffersForCaching(), hasCachedMetadataForKeyPrefix(), hasStoredDataWrapperMetadata(), isMetadataCached(), putBuffer(), and storeDataWrapper().