OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::ForeignStorageCache Class Reference

#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::FileBuffergetCachedChunkIfExists (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< ChunkKeygetCachedChunksForKeyPrefix (const ChunkKey &) const
 
ChunkToBufferMap getChunkBuffersForCaching (const std::set< ChunkKey > &chunk_keys) const
 
AbstractBuffergetChunkBufferForPrecaching (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
 
void cacheMetadataWithFragIdGreaterOrEqualTo (const ChunkMetadataVector &metadata_vec, const int frag_id)
 
uint64_t getSpaceReservedByTable (int db_id, int tb_id) const
 
void storeDataWrapper (const std::string &doc, int32_t db_id, int32_t tb_id)
 
void setDataSizeLimit (size_t max) const
 

Private Member Functions

std::set< ChunkKey >::iterator eraseChunk (const std::set< ChunkKey >::iterator &)
 
void eraseChunk (const ChunkKey &chunk_key)
 
void validatePath (const std::string &) const
 

Private Attributes

std::unique_ptr
< File_Namespace::CachingFileMgr
caching_file_mgr_
 

Detailed Description

Definition at line 42 of file ForeignStorageCache.h.

Constructor & Destructor Documentation

foreign_storage::ForeignStorageCache::ForeignStorageCache ( const File_Namespace::DiskCacheConfig config)

Definition at line 55 of file ForeignStorageCache.cpp.

References caching_file_mgr_, File_Namespace::DiskCacheConfig::path, and validatePath().

55  {
56  validatePath(config.path);
57  caching_file_mgr_ = std::make_unique<File_Namespace::CachingFileMgr>(config);
58 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
void validatePath(const std::string &) const

+ Here is the call graph for this function:

Member Function Documentation

void foreign_storage::ForeignStorageCache::cacheMetadataVec ( const ChunkMetadataVector metadata_vec)

Definition at line 112 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 cacheMetadataWithFragIdGreaterOrEqualTo(), foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), File_Namespace::CachingGlobalFileMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::refreshNonAppendTableInCache().

112  {
113  auto timer = DEBUG_TIMER(__func__);
114  if (metadata_vec.empty()) {
115  return;
116  }
117  auto first_chunk_key = metadata_vec.begin()->first;
118  for (auto& [chunk_key, metadata] : metadata_vec) {
119  CHECK(in_same_table(chunk_key, first_chunk_key));
120  AbstractBuffer* buf;
121  AbstractBuffer* index_buffer = nullptr;
122  ChunkKey index_chunk_key;
123  if (is_varlen_key(chunk_key)) {
124  // For variable length chunks, metadata is associated with the data chunk.
125  CHECK(is_varlen_data_key(chunk_key));
126  index_chunk_key = {chunk_key[CHUNK_KEY_DB_IDX],
127  chunk_key[CHUNK_KEY_TABLE_IDX],
128  chunk_key[CHUNK_KEY_COLUMN_IDX],
129  chunk_key[CHUNK_KEY_FRAGMENT_IDX],
130  2};
131  }
132  bool chunk_in_cache = false;
133  if (!caching_file_mgr_->isBufferOnDevice(chunk_key)) {
134  buf = caching_file_mgr_->createBuffer(chunk_key);
135 
136  if (!index_chunk_key.empty()) {
137  CHECK(!caching_file_mgr_->isBufferOnDevice(index_chunk_key));
138  index_buffer = caching_file_mgr_->createBuffer(index_chunk_key);
139  CHECK(index_buffer);
140  }
141  } else {
142  buf = caching_file_mgr_->getBuffer(chunk_key);
143 
144  if (!index_chunk_key.empty()) {
145  CHECK(caching_file_mgr_->isBufferOnDevice(index_chunk_key));
146  index_buffer = caching_file_mgr_->getBuffer(index_chunk_key);
147  CHECK(index_buffer);
148  }
149 
150  // We should have already cleared the data unless we are appending
151  // If the buffer metadata has changed, we need to remove this chunk
152  if (buf->getEncoder() != nullptr) {
153  const std::shared_ptr<ChunkMetadata> buf_metadata =
154  std::make_shared<ChunkMetadata>();
155  buf->getEncoder()->getMetadata(buf_metadata);
156  chunk_in_cache = *metadata.get() == *buf_metadata;
157  }
158  }
159 
160  if (!chunk_in_cache) {
161  set_metadata_for_buffer(buf, metadata.get());
162  eraseChunk(chunk_key);
163 
164  if (!index_chunk_key.empty()) {
165  CHECK(index_buffer);
166  index_buffer->setUpdated();
167  eraseChunk(index_chunk_key);
168  }
169  }
170  }
171  caching_file_mgr_->checkpoint(first_chunk_key[CHUNK_KEY_DB_IDX],
172  first_chunk_key[CHUNK_KEY_TABLE_IDX]);
173 }
std::vector< int > ChunkKey
Definition: types.h:37
bool is_varlen_data_key(const ChunkKey &key)
Definition: types.h:76
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
#define CHUNK_KEY_FRAGMENT_IDX
Definition: types.h:42
virtual void getMetadata(const std::shared_ptr< ChunkMetadata > &chunkMetadata)
Definition: Encoder.cpp:227
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
An AbstractBuffer is a unit of data management for a data manager.
std::set< ChunkKey >::iterator eraseChunk(const std::set< ChunkKey >::iterator &)
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
void set_metadata_for_buffer(AbstractBuffer *buffer, ChunkMetadata *meta)
#define CHECK(condition)
Definition: Logger.h:223
#define DEBUG_TIMER(name)
Definition: Logger.h:370
#define CHUNK_KEY_COLUMN_IDX
Definition: types.h:41
bool in_same_table(const ChunkKey &left_key, const ChunkKey &right_key)
Definition: types.h:84
bool is_varlen_key(const ChunkKey &key)
Definition: types.h:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::cacheMetadataWithFragIdGreaterOrEqualTo ( const ChunkMetadataVector metadata_vec,
const int  frag_id 
)

Definition at line 243 of file ForeignStorageCache.cpp.

References cacheMetadataVec(), and CHUNK_KEY_FRAGMENT_IDX.

Referenced by foreign_storage::CachingForeignStorageMgr::refreshAppendTableInCache().

245  {
246  // Only re-cache last fragment and above
247  ChunkMetadataVector new_metadata_vec;
248  for (const auto& chunk_metadata : metadata_vec) {
249  if (chunk_metadata.first[CHUNK_KEY_FRAGMENT_IDX] >= frag_id) {
250  new_metadata_vec.push_back(chunk_metadata);
251  }
252  }
253  cacheMetadataVec(new_metadata_vec);
254 }
#define CHUNK_KEY_FRAGMENT_IDX
Definition: types.h:42
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata >>> ChunkMetadataVector
void cacheMetadataVec(const ChunkMetadataVector &)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::checkpoint ( const int32_t  db_id,
const int32_t  tb_id 
)

Definition at line 71 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by File_Namespace::CachingGlobalFileMgr::checkpoint(), foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecFromDataWrapper(), and foreign_storage::CachingForeignStorageMgr::populateChunkBuffersSafely().

71  {
72  caching_file_mgr_->checkpoint(db_id, tb_id);
73 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::clear ( )

Definition at line 193 of file ForeignStorageCache.cpp.

References caching_file_mgr_, and DEBUG_TIMER.

193  {
194  auto timer = DEBUG_TIMER(__func__);
195  // FileMgrs do not clean up after themselves nicely, so we need to close all their disk
196  // resources and then re-create the CachingFileMgr to reset it.
197  caching_file_mgr_->closeRemovePhysical();
198  boost::filesystem::create_directory(caching_file_mgr_->getFileMgrBasePath());
199  caching_file_mgr_ = caching_file_mgr_->reconstruct();
200 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define DEBUG_TIMER(name)
Definition: Logger.h:370
void foreign_storage::ForeignStorageCache::clearForTablePrefix ( const ChunkKey chunk_prefix)

Definition at line 186 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 foreign_storage::CachingForeignStorageMgr::clearTable(), File_Namespace::CachingGlobalFileMgr::deleteBuffersWithPrefix(), foreign_storage::CachingForeignStorageMgr::removeTableRelatedDS(), and File_Namespace::CachingGlobalFileMgr::removeTableRelatedDS().

186  {
187  CHECK(is_table_key(chunk_prefix));
188  auto timer = DEBUG_TIMER(__func__);
189  caching_file_mgr_->clearForTable(chunk_prefix[CHUNK_KEY_DB_IDX],
190  chunk_prefix[CHUNK_KEY_TABLE_IDX]);
191 }
bool is_table_key(const ChunkKey &key)
Definition: types.h:45
#define CHUNK_KEY_DB_IDX
Definition: types.h:39
#define CHUNK_KEY_TABLE_IDX
Definition: types.h:40
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define CHECK(condition)
Definition: Logger.h:223
#define DEBUG_TIMER(name)
Definition: Logger.h:370

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::deleteBufferIfExists ( const ChunkKey chunk_key)

Definition at line 60 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by File_Namespace::CachingGlobalFileMgr::deleteBuffer().

60  {
61  caching_file_mgr_->deleteBufferIfExists(chunk_key);
62 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

std::string foreign_storage::ForeignStorageCache::dump ( ) const
inline

Definition at line 77 of file ForeignStorageCache.h.

77 { return caching_file_mgr_->dump(); }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::string foreign_storage::ForeignStorageCache::dumpCachedChunkEntries ( ) const

Definition at line 211 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

211  {
212  return caching_file_mgr_->dumpKeysWithChunkData();
213 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::string foreign_storage::ForeignStorageCache::dumpCachedMetadataEntries ( ) const

Definition at line 215 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

215  {
216  return caching_file_mgr_->dumpKeysWithMetadata();
217 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::string foreign_storage::ForeignStorageCache::dumpEvictionQueue ( ) const

Definition at line 219 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

219  {
220  return caching_file_mgr_->dumpEvictionQueue();
221 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::set<ChunkKey>::iterator foreign_storage::ForeignStorageCache::eraseChunk ( const std::set< ChunkKey >::iterator &  )
private

Referenced by cacheMetadataVec().

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::eraseChunk ( const ChunkKey chunk_key)
private

Definition at line 207 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

207  {
208  caching_file_mgr_->removeChunkKeepMetadata(chunk_key);
209 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
File_Namespace::FileBuffer * foreign_storage::ForeignStorageCache::getCachedChunkIfExists ( const ChunkKey chunk_key)

Definition at line 75 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(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

76  {
77  auto buf = caching_file_mgr_->getBufferIfExists(chunk_key);
78 
79  if (buf) {
80  if ((*buf)->hasDataPages()) {
81  // 1. If the buffer has data pages then must be in the cache.
82  return *buf;
83  }
84  if (is_varlen_data_key(chunk_key)) {
85  // 2. If the buffer is a varlen data buffer and the
86  // corresponding chunk contains only nulls, then even
87  // without data pages it will still have been cached
88  // if it has a corresponding index buffer which does
89  // have dataPages
90  // Note the empty buffer proviso that the size be 0,
91  // corresponding to all nulls in the chunk
92  auto index_chunk_key = chunk_key;
93  index_chunk_key[CHUNK_KEY_VARLEN_IDX] = 2;
94  auto index_buffer = caching_file_mgr_->getBufferIfExists(index_chunk_key);
95  if (index_buffer && (*index_buffer)->hasDataPages() && (*buf)->size() == 0) {
96  return *buf;
97  }
98  }
99  }
100  // 3. Otherwise this chunk hasn't been cached.
101  return nullptr;
102 }
bool is_varlen_data_key(const ChunkKey &key)
Definition: types.h:76
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define CHUNK_KEY_VARLEN_IDX
Definition: types.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< ChunkKey > foreign_storage::ForeignStorageCache::getCachedChunksForKeyPrefix ( const ChunkKey chunk_prefix) const

Definition at line 202 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by foreign_storage::CachingForeignStorageMgr::refreshTableInCache().

203  {
204  return caching_file_mgr_->getChunkKeysForPrefix(chunk_prefix);
205 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

std::string foreign_storage::ForeignStorageCache::getCacheDirectory ( ) const
inline

Definition at line 79 of file ForeignStorageCache.h.

79  {
80  return caching_file_mgr_->getFileMgrBasePath();
81  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::string foreign_storage::ForeignStorageCache::getCacheDirectoryForTable ( int  db_id,
int  tb_id 
) const
inline

Definition at line 83 of file ForeignStorageCache.h.

83  {
84  return caching_file_mgr_->getTableFileMgrPath(db_id, tb_id);
85  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
void foreign_storage::ForeignStorageCache::getCachedMetadataVecForKeyPrefix ( ChunkMetadataVector metadata_vec,
const ChunkKey chunk_prefix 
) const

Definition at line 175 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().

177  {
178  caching_file_mgr_->getChunkMetadataVecForKeyPrefix(metadata_vec, chunk_prefix);
179 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

AbstractBuffer * foreign_storage::ForeignStorageCache::getChunkBufferForPrecaching ( const ChunkKey chunk_key,
bool  is_new_buffer 
)

Definition at line 272 of file ForeignStorageCache.cpp.

References caching_file_mgr_, and CHECK.

274  {
275  if (!is_new_buffer) {
276  CHECK(caching_file_mgr_->isBufferOnDevice(chunk_key));
277  return caching_file_mgr_->getBuffer(chunk_key);
278  } else {
279  CHECK(!caching_file_mgr_->isBufferOnDevice(chunk_key));
280  return caching_file_mgr_->createBuffer(chunk_key);
281  }
282 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define CHECK(condition)
Definition: Logger.h:223
ChunkToBufferMap foreign_storage::ForeignStorageCache::getChunkBuffersForCaching ( const std::set< ChunkKey > &  chunk_keys) const

Definition at line 256 of file ForeignStorageCache.cpp.

References caching_file_mgr_, and CHECK.

Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), and foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

257  {
258  ChunkToBufferMap chunk_buffer_map;
259  for (const auto& key : keys) {
260  CHECK(caching_file_mgr_->isBufferOnDevice(key));
261  chunk_buffer_map[key] = caching_file_mgr_->getBuffer(key);
262  auto file_buf = dynamic_cast<File_Namespace::FileBuffer*>(chunk_buffer_map[key]);
263  CHECK(file_buf);
264  CHECK(!file_buf->hasDataPages());
265 
266  // Clear all buffer metadata
267  file_buf->resetToEmpty();
268  }
269  return chunk_buffer_map;
270 }
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
Represents/provides access to contiguous data stored in the file system.
Definition: FileBuffer.h:58
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

size_t foreign_storage::ForeignStorageCache::getMaxChunkDataSize ( ) const
inline

Definition at line 55 of file ForeignStorageCache.h.

Referenced by foreign_storage::CachingForeignStorageMgr::maxFetchSize().

55 { return caching_file_mgr_->getMaxDataFilesSize(); }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

size_t foreign_storage::ForeignStorageCache::getNumCachedChunks ( ) const
inline

Definition at line 66 of file ForeignStorageCache.h.

66  {
67  return caching_file_mgr_->getNumDataChunks();
68  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
size_t foreign_storage::ForeignStorageCache::getNumCachedMetadata ( ) const
inline

Definition at line 69 of file ForeignStorageCache.h.

69  {
70  return caching_file_mgr_->getNumChunksWithMetadata();
71  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
std::string foreign_storage::ForeignStorageCache::getSerializedWrapperPath ( int32_t  db_id,
int32_t  tb_id 
) const
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().

87  {
88  return getCacheDirectoryForTable(db_id, tb_id) + "/" +
90  }
std::string getCacheDirectoryForTable(int db_id, int tb_id) const
static constexpr char WRAPPER_FILE_NAME[]

+ Here is the caller graph for this function:

uint64_t foreign_storage::ForeignStorageCache::getSpaceReservedByTable ( int  db_id,
int  tb_id 
) const
inline

Definition at line 95 of file ForeignStorageCache.h.

95  {
96  return caching_file_mgr_->getSpaceReservedByTable(db_id, tb_id);
97  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
bool foreign_storage::ForeignStorageCache::hasCachedMetadataForKeyPrefix ( const ChunkKey chunk_prefix) const

Definition at line 181 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecForKeyPrefix(), File_Namespace::CachingGlobalFileMgr::getChunkMetadataVecForKeyPrefix(), and foreign_storage::CachingForeignStorageMgr::getHighestCachedFragId().

182  {
183  return caching_file_mgr_->hasChunkMetadataForKeyPrefix(chunk_prefix);
184 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

bool foreign_storage::ForeignStorageCache::isMetadataCached ( const ChunkKey chunk_key) const

Definition at line 104 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by foreign_storage::CachingForeignStorageMgr::refreshChunksInCacheByFragment().

104  {
105  auto buf = caching_file_mgr_->getBufferIfExists(chunk_key);
106  if (buf) {
107  return (*buf)->hasEncoder();
108  }
109  return false;
110 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::putBuffer ( const ChunkKey key,
AbstractBuffer buf,
const size_t  numBytes = 0 
)

Definition at line 64 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().

66  {
67  caching_file_mgr_->putBuffer(key, buf, num_bytes);
68  CHECK(!buf->isDirty());
69 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::setDataSizeLimit ( size_t  max) const
inline

Definition at line 102 of file ForeignStorageCache.h.

102  {
103  caching_file_mgr_->setDataSizeLimit(max);
104  }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_
void foreign_storage::ForeignStorageCache::storeDataWrapper ( const std::string &  doc,
int32_t  db_id,
int32_t  tb_id 
)

Definition at line 284 of file ForeignStorageCache.cpp.

References caching_file_mgr_.

Referenced by foreign_storage::CachingForeignStorageMgr::getChunkMetadataVecFromDataWrapper().

286  {
287  caching_file_mgr_->writeWrapperFile(doc, db_id, tb_id);
288 }
std::unique_ptr< File_Namespace::CachingFileMgr > caching_file_mgr_

+ Here is the caller graph for this function:

void foreign_storage::ForeignStorageCache::validatePath ( const std::string &  base_path) const
private

Definition at line 223 of file ForeignStorageCache.cpp.

Referenced by ForeignStorageCache().

223  {
224  // check if base_path already exists, and if not create one
225  boost::filesystem::path path(base_path);
226  if (boost::filesystem::exists(path)) {
227  if (!boost::filesystem::is_directory(path)) {
228  throw std::runtime_error{
229  "cache path \"" + base_path +
230  "\" is not a directory. Please specify a valid directory "
231  "with --disk_cache_path=<path>, or use the default location."};
232  }
233  } else { // data directory does not exist
234  if (!boost::filesystem::create_directory(path)) {
235  throw std::runtime_error{
236  "could not create directory at cache path \"" + base_path +
237  "\". Please specify a valid directory location "
238  "with --disk_cache_path=<path> or use the default location."};
239  }
240  }
241 }

+ Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following files: