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

#include <DataMgr.h>

+ Collaboration diagram for Data_Namespace::DataMgr:

Classes

struct  SystemMemoryUsage
 

Public Member Functions

 DataMgr (const std::string &dataDir, const SystemParameters &system_parameters, std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr, const bool useGpus, const size_t reservedGpuMem=(1<< 27), const size_t numReaderThreads=0, const File_Namespace::DiskCacheConfig cacheConfig=File_Namespace::DiskCacheConfig())
 
 ~DataMgr ()
 
AbstractBuffercreateChunkBuffer (const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t page_size=0)
 
AbstractBuffergetChunkBuffer (const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t numBytes=0)
 
void deleteChunksWithPrefix (const ChunkKey &keyPrefix)
 
void deleteChunksWithPrefix (const ChunkKey &keyPrefix, const MemoryLevel memLevel)
 
AbstractBufferalloc (const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes)
 
void free (AbstractBuffer *buffer)
 
void copy (AbstractBuffer *destBuffer, AbstractBuffer *srcBuffer)
 
bool isBufferOnDevice (const ChunkKey &key, const MemoryLevel memLevel, const int deviceId)
 
std::vector< MemoryInfogetMemoryInfo (const MemoryLevel memLevel) const
 
std::vector< MemoryInfogetMemoryInfoUnlocked (const MemoryLevel memLevel) const
 
std::string dumpLevel (const MemoryLevel memLevel)
 
void clearMemory (const MemoryLevel memLevel)
 
const std::map< ChunkKey,
File_Namespace::FileBuffer * > & 
getChunkMap ()
 
void checkpoint (const int db_id, const int tb_id)
 
void checkpoint (const int db_id, const int table_id, const MemoryLevel memory_level)
 
void getChunkMetadataVecForKeyPrefix (ChunkMetadataVector &chunkMetadataVec, const ChunkKey &keyPrefix)
 
bool gpusPresent () const
 
void removeTableRelatedDS (const int db_id, const int tb_id)
 
void setTableEpoch (const int db_id, const int tb_id, const int start_epoch)
 
size_t getTableEpoch (const int db_id, const int tb_id)
 
void resetTableEpochFloor (const int32_t db_id, const int32_t tb_id)
 
CudaMgr_Namespace::CudaMgrgetCudaMgr () const
 
File_Namespace::GlobalFileMgrgetGlobalFileMgr () const
 
std::shared_ptr
< ForeignStorageInterface
getForeignStorageInterface () const
 
SystemMemoryUsage getSystemMemoryUsage () const
 
PersistentStorageMgrgetPersistentStorageMgr () const
 
void resetPersistentStorage (const File_Namespace::DiskCacheConfig &cache_config, const size_t num_reader_threads, const SystemParameters &sys_params)
 
Buffer_Namespace::CpuBufferMgrgetCpuBufferMgr () const
 
Buffer_Namespace::GpuCudaBufferMgrgetGpuBufferMgr (int32_t device_id) const
 

Static Public Member Functions

static size_t getTotalSystemMemory ()
 

Public Attributes

std::vector< int > levelSizes_
 

Private Member Functions

void populateMgrs (const SystemParameters &system_parameters, const size_t userSpecifiedNumReaderThreads, const File_Namespace::DiskCacheConfig &cache_config)
 
void convertDB (const std::string basePath)
 
void checkpoint ()
 
void createTopLevelMetadata () const
 
void allocateCpuBufferMgr (int32_t device_id, size_t total_cpu_size, size_t minCpuSlabSize, size_t maxCpuSlabSize, size_t page_size, const std::vector< size_t > &cpu_tier_sizes)
 

Private Attributes

std::vector< std::vector
< AbstractBufferMgr * > > 
bufferMgrs_
 
std::unique_ptr
< CudaMgr_Namespace::CudaMgr
cudaMgr_
 
std::string dataDir_
 
bool hasGpus_
 
size_t reservedGpuMem_
 
std::mutex buffer_access_mutex_
 

Friends

class GlobalFileMgr
 

Detailed Description

Definition at line 172 of file DataMgr.h.

Constructor & Destructor Documentation

Data_Namespace::DataMgr::DataMgr ( const std::string &  dataDir,
const SystemParameters system_parameters,
std::unique_ptr< CudaMgr_Namespace::CudaMgr cudaMgr,
const bool  useGpus,
const size_t  reservedGpuMem = (1 << 27),
const size_t  numReaderThreads = 0,
const File_Namespace::DiskCacheConfig  cacheConfig = File_Namespace::DiskCacheConfig() 
)
explicit

Definition at line 51 of file DataMgr.cpp.

58  : cudaMgr_{std::move(cudaMgr)}
59  , dataDir_{dataDir}
60  , hasGpus_{false}
61  , reservedGpuMem_{reservedGpuMem} {
62  if (useGpus) {
63  if (cudaMgr_) {
64  hasGpus_ = true;
65  } else {
66  LOG(ERROR) << "CudaMgr instance is invalid, falling back to CPU-only mode.";
67  hasGpus_ = false;
68  }
69  } else {
70  // NOTE: useGpus == false with a valid cudaMgr is a potentially valid configuration.
71  // i.e. QueryEngine can be set to cpu-only for a cuda-enabled build, but still have
72  // rendering enabled. The renderer would require a CudaMgr in this case, in addition
73  // to a GpuCudaBufferMgr for cuda-backed thrust allocations.
74  // We're still setting hasGpus_ to false in that case tho to enforce cpu-only query
75  // execution.
76  hasGpus_ = false;
77  }
78 
79  populateMgrs(system_parameters, numReaderThreads, cache_config);
81 }
#define LOG(tag)
Definition: Logger.h:217
void createTopLevelMetadata() const
Definition: DataMgr.cpp:336
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271
void populateMgrs(const SystemParameters &system_parameters, const size_t userSpecifiedNumReaderThreads, const File_Namespace::DiskCacheConfig &cache_config)
Definition: DataMgr.cpp:216
std::string dataDir_
Definition: DataMgr.h:272
Data_Namespace::DataMgr::~DataMgr ( )

Definition at line 83 of file DataMgr.cpp.

References bufferMgrs_.

83  {
84  int numLevels = bufferMgrs_.size();
85  for (int level = numLevels - 1; level >= 0; --level) {
86  for (size_t device = 0; device < bufferMgrs_[level].size(); device++) {
87  delete bufferMgrs_[level][device];
88  }
89  }
90 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

Member Function Documentation

AbstractBuffer * Data_Namespace::DataMgr::alloc ( const MemoryLevel  memoryLevel,
const int  deviceId,
const size_t  numBytes 
)

Definition at line 519 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.

Referenced by ThrustAllocator::allocate(), ThrustAllocator::allocateScopedBuffer(), CudaAllocator::allocGpuAbstractBuffer(), InValuesBitmap::InValuesBitmap(), ColumnFetcher::linearizeFixedLenArrayColFrags(), and ColumnFetcher::linearizeVarLenArrayColFrags().

521  {
522  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
523  const auto level = static_cast<int>(memoryLevel);
524  CHECK_LT(deviceId, levelSizes_[level]);
525  return bufferMgrs_[level][deviceId]->alloc(numBytes);
526 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227
#define CHECK_LT(x, y)
Definition: Logger.h:233

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::allocateCpuBufferMgr ( int32_t  device_id,
size_t  total_cpu_size,
size_t  minCpuSlabSize,
size_t  maxCpuSlabSize,
size_t  page_size,
const std::vector< size_t > &  cpu_tier_sizes 
)
private

Definition at line 172 of file DataMgr.cpp.

References bufferMgrs_, and cudaMgr_.

Referenced by populateMgrs().

177  {
178 #ifdef ENABLE_MEMKIND
179  if (g_enable_tiered_cpu_mem) {
181  total_cpu_size,
182  cudaMgr_.get(),
183  minCpuSlabSize,
184  maxCpuSlabSize,
185  page_size,
186  cpu_tier_sizes,
187  bufferMgrs_[0][0]));
188  return;
189  }
190 #endif
191 
192  bufferMgrs_[1].push_back(new Buffer_Namespace::CpuBufferMgr(0,
193  total_cpu_size,
194  cudaMgr_.get(),
195  minCpuSlabSize,
196  maxCpuSlabSize,
197  page_size,
198  bufferMgrs_[0][0]));
199 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::checkpoint ( const int  db_id,
const int  tb_id 
)

Definition at line 548 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

Referenced by UpdelRoll::stageUpdate().

548  {
549  // TODO(adb): do we need a buffer mgr lock here?
550  // MAT Yes to reduce Parallel Executor TSAN issues (and correctness for now)
551  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
552  for (auto levelIt = bufferMgrs_.rbegin(); levelIt != bufferMgrs_.rend(); ++levelIt) {
553  // use reverse iterator so we start at GPU level, then CPU then DISK
554  for (auto deviceIt = levelIt->begin(); deviceIt != levelIt->end(); ++deviceIt) {
555  (*deviceIt)->checkpoint(db_id, tb_id);
556  }
557  }
558 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::checkpoint ( const int  db_id,
const int  table_id,
const MemoryLevel  memory_level 
)

Definition at line 560 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.

562  {
563  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
564  CHECK_LT(static_cast<size_t>(memory_level), bufferMgrs_.size());
565  CHECK_LT(static_cast<size_t>(memory_level), levelSizes_.size());
566  for (int device_id = 0; device_id < levelSizes_[memory_level]; device_id++) {
567  bufferMgrs_[memory_level][device_id]->checkpoint(db_id, table_id);
568  }
569 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227
#define CHECK_LT(x, y)
Definition: Logger.h:233
void Data_Namespace::DataMgr::checkpoint ( )
private

Definition at line 571 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

Referenced by convertDB().

571  {
572  // TODO(adb): SAA
573  // MAT Yes to reduce Parallel Executor TSAN issues (and correctness for now)
574  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
575  for (auto levelIt = bufferMgrs_.rbegin(); levelIt != bufferMgrs_.rend(); ++levelIt) {
576  // use reverse iterator so we start at GPU level, then CPU then DISK
577  for (auto deviceIt = levelIt->begin(); deviceIt != levelIt->end(); ++deviceIt) {
578  (*deviceIt)->checkpoint();
579  }
580  }
581 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::clearMemory ( const MemoryLevel  memLevel)

Definition at line 437 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, CHECK, cudaMgr_, Data_Namespace::GPU_LEVEL, logger::INFO, LOG, and logger::WARNING.

Referenced by Executor::clearMemory().

437  {
438  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
439 
440  // if gpu we need to iterate through all the buffermanagers for each card
441  if (memLevel == MemoryLevel::GPU_LEVEL) {
442  if (cudaMgr_) {
443  int numGpus = cudaMgr_->getDeviceCount();
444  for (int gpuNum = 0; gpuNum < numGpus; ++gpuNum) {
445  LOG(INFO) << "clear slabs on gpu " << gpuNum;
446  auto buffer_mgr_for_gpu =
447  dynamic_cast<Buffer_Namespace::BufferMgr*>(bufferMgrs_[memLevel][gpuNum]);
448  CHECK(buffer_mgr_for_gpu);
449  buffer_mgr_for_gpu->clearSlabs();
450  }
451  } else {
452  LOG(WARNING) << "Unable to clear GPU memory: No GPUs detected";
453  }
454  } else {
455  auto buffer_mgr_for_cpu =
456  dynamic_cast<Buffer_Namespace::BufferMgr*>(bufferMgrs_[memLevel][0]);
457  CHECK(buffer_mgr_for_cpu);
458  buffer_mgr_for_cpu->clearSlabs();
459  }
460 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
#define LOG(tag)
Definition: Logger.h:217
Note(s): Forbid Copying Idiom 4.1.
Definition: BufferMgr.h:96
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::convertDB ( const std::string  basePath)
private

Definition at line 303 of file DataMgr.cpp.

References bufferMgrs_, CHECK, checkpoint(), logger::FATAL, getGlobalFileMgr(), logger::INFO, shared::kDataDirectoryName, and LOG.

303  {
304  // no need for locking, as this is only called in the constructor
305 
306  /* check that the data directory exists and it's empty */
307  std::string mapdDataPath(basePath + "/../" + shared::kDataDirectoryName + "/");
308  boost::filesystem::path path(mapdDataPath);
309  if (boost::filesystem::exists(path)) {
310  if (!boost::filesystem::is_directory(path)) {
311  LOG(FATAL) << "Path to directory \"" + shared::kDataDirectoryName +
312  "\" to convert DB is not a directory.";
313  }
314  } else { // data directory does not exist
315  LOG(FATAL) << "Path to directory \"" + shared::kDataDirectoryName +
316  "\" to convert DB does not exist.";
317  }
318 
319  File_Namespace::GlobalFileMgr* gfm{nullptr};
320  gfm = dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
321  CHECK(gfm);
322 
323  size_t defaultPageSize = gfm->getDefaultPageSize();
324  LOG(INFO) << "Database conversion started.";
326  gfm,
327  defaultPageSize,
328  basePath); // this call also copies data into new DB structure
329  delete fm_base_db;
330 
331  /* write content of DB into newly created/converted DB structure & location */
332  checkpoint(); // outputs data files as well as metadata files
333  LOG(INFO) << "Database conversion completed.";
334 }
const std::string kDataDirectoryName
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
#define LOG(tag)
Definition: Logger.h:217
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

void Data_Namespace::DataMgr::copy ( AbstractBuffer destBuffer,
AbstractBuffer srcBuffer 
)

Definition at line 534 of file DataMgr.cpp.

References Data_Namespace::AbstractBuffer::getDeviceId(), Data_Namespace::AbstractBuffer::getMemoryPtr(), Data_Namespace::AbstractBuffer::getType(), Data_Namespace::AbstractBuffer::size(), and Data_Namespace::AbstractBuffer::write().

534  {
535  destBuffer->write(srcBuffer->getMemoryPtr(),
536  srcBuffer->size(),
537  0,
538  srcBuffer->getType(),
539  srcBuffer->getDeviceId());
540 }
virtual int8_t * getMemoryPtr()=0
virtual MemoryLevel getType() const =0
virtual void write(int8_t *src, const size_t num_bytes, const size_t offset=0, const MemoryLevel src_buffer_type=CPU_LEVEL, const int src_device_id=-1)=0

+ Here is the call graph for this function:

AbstractBuffer * Data_Namespace::DataMgr::createChunkBuffer ( const ChunkKey key,
const MemoryLevel  memoryLevel,
const int  deviceId = 0,
const size_t  page_size = 0 
)

Definition at line 475 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

Referenced by Chunk_NS::Chunk::createChunkBuffer().

478  {
479  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
480  int level = static_cast<int>(memoryLevel);
481  return bufferMgrs_[level][deviceId]->createBuffer(key, page_size);
482 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::createTopLevelMetadata ( ) const
private

Definition at line 336 of file DataMgr.cpp.

References bufferMgrs_, CHECK, and getGlobalFileMgr().

Referenced by resetPersistentStorage().

337  { // create metadata shared by all tables of all DBs
338  ChunkKey chunkKey(2);
339  chunkKey[0] = 0; // top level db_id
340  chunkKey[1] = 0; // top level tb_id
341 
342  File_Namespace::GlobalFileMgr* gfm{nullptr};
343  gfm = dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
344  CHECK(gfm);
345 
346  auto fm_top = gfm->getFileMgr(chunkKey);
347  if (dynamic_cast<File_Namespace::FileMgr*>(fm_top)) {
348  static_cast<File_Namespace::FileMgr*>(fm_top)->createTopLevelMetadata();
349  }
350 }
std::vector< int > ChunkKey
Definition: types.h:37
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
void createTopLevelMetadata() const
Definition: DataMgr.cpp:336
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::deleteChunksWithPrefix ( const ChunkKey keyPrefix)

Definition at line 495 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, and levelSizes_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::prepare_for_system_table_execution(), UpdelRoll::updateFragmenterAndCleanupChunks(), StorageIOFacility::yieldDeleteCallback(), and StorageIOFacility::yieldUpdateCallback().

495  {
496  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
497 
498  int numLevels = bufferMgrs_.size();
499  for (int level = numLevels - 1; level >= 0; --level) {
500  for (int device = 0; device < levelSizes_[level]; ++device) {
501  bufferMgrs_[level][device]->deleteBuffersWithPrefix(keyPrefix);
502  }
503  }
504 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::deleteChunksWithPrefix ( const ChunkKey keyPrefix,
const MemoryLevel  memLevel 
)

Definition at line 507 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, and levelSizes_.

508  {
509  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
510 
511  if (bufferMgrs_.size() <= memLevel) {
512  return;
513  }
514  for (int device = 0; device < levelSizes_[memLevel]; ++device) {
515  bufferMgrs_[memLevel][device]->deleteBuffersWithPrefix(keyPrefix);
516  }
517 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227
std::string Data_Namespace::DataMgr::dumpLevel ( const MemoryLevel  memLevel)

Definition at line 421 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, cudaMgr_, and Data_Namespace::GPU_LEVEL.

421  {
422  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
423 
424  // if gpu we need to iterate through all the buffermanagers for each card
425  if (memLevel == MemoryLevel::GPU_LEVEL) {
426  int numGpus = cudaMgr_->getDeviceCount();
427  std::ostringstream tss;
428  for (int gpuNum = 0; gpuNum < numGpus; ++gpuNum) {
429  tss << bufferMgrs_[memLevel][gpuNum]->printSlabs();
430  }
431  return tss.str();
432  } else {
433  return bufferMgrs_[memLevel][0]->printSlabs();
434  }
435 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271
void Data_Namespace::DataMgr::free ( AbstractBuffer buffer)

Definition at line 528 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, Data_Namespace::AbstractBuffer::getDeviceId(), and Data_Namespace::AbstractBuffer::getType().

Referenced by UpdelRoll::cancelUpdate(), ThrustAllocator::deallocate(), CudaAllocator::free(), CudaAllocator::freeGpuAbstractBuffer(), CudaAllocator::~CudaAllocator(), InValuesBitmap::~InValuesBitmap(), PerfectHashTable::~PerfectHashTable(), StringDictionaryTranslationMgr::~StringDictionaryTranslationMgr(), and ThrustAllocator::~ThrustAllocator().

528  {
529  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
530  int level = static_cast<int>(buffer->getType());
531  bufferMgrs_[level][buffer->getDeviceId()]->free(buffer);
532 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
virtual MemoryLevel getType() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AbstractBuffer * Data_Namespace::DataMgr::getChunkBuffer ( const ChunkKey key,
const MemoryLevel  memoryLevel,
const int  deviceId = 0,
const size_t  numBytes = 0 
)

Definition at line 484 of file DataMgr.cpp.

References buffer_access_mutex_, bufferMgrs_, CHECK_LT, and levelSizes_.

Referenced by Chunk_NS::Chunk::getChunkBuffer().

487  {
488  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
489  const auto level = static_cast<size_t>(memoryLevel);
490  CHECK_LT(level, levelSizes_.size()); // make sure we have a legit buffermgr
491  CHECK_LT(deviceId, levelSizes_[level]); // make sure we have a legit buffermgr
492  return bufferMgrs_[level][deviceId]->getBuffer(key, numBytes);
493 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227
#define CHECK_LT(x, y)
Definition: Logger.h:233

+ Here is the caller graph for this function:

const std::map<ChunkKey, File_Namespace::FileBuffer*>& Data_Namespace::DataMgr::getChunkMap ( )
void Data_Namespace::DataMgr::getChunkMetadataVecForKeyPrefix ( ChunkMetadataVector chunkMetadataVec,
const ChunkKey keyPrefix 
)

Definition at line 469 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

Referenced by TableOptimizer::vacuumFragments().

470  {
471  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
472  bufferMgrs_[0][0]->getChunkMetadataVecForKeyPrefix(chunkMetadataVec, keyPrefix);
473 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

Buffer_Namespace::CpuBufferMgr * Data_Namespace::DataMgr::getCpuBufferMgr ( ) const

Definition at line 641 of file DataMgr.cpp.

References bufferMgrs_, and Data_Namespace::CPU_LEVEL.

641  {
642  return dynamic_cast<Buffer_Namespace::CpuBufferMgr*>(
644 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
CudaMgr_Namespace::CudaMgr* Data_Namespace::DataMgr::getCudaMgr ( ) const
inline

Definition at line 222 of file DataMgr.h.

References cudaMgr_.

Referenced by Executor::blockSize(), copy_to_nvidia_gpu(), CudaAllocator::copyFromDevice(), CudaAllocator::copyToDevice(), CudaAllocator::CudaAllocator(), Executor::cudaMgr(), get_available_gpus(), Executor::gridSize(), Executor::isCPUOnly(), CudaAllocator::setDeviceMem(), and CudaAllocator::zeroDeviceMem().

222 { return cudaMgr_.get(); }
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271

+ Here is the caller graph for this function:

std::shared_ptr< ForeignStorageInterface > Data_Namespace::DataMgr::getForeignStorageInterface ( ) const

Definition at line 617 of file DataMgr.cpp.

References bufferMgrs_.

617  {
618  return dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])
620 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::shared_ptr< ForeignStorageInterface > getForeignStorageInterface() const
Definition: DataMgr.cpp:617
File_Namespace::GlobalFileMgr * Data_Namespace::DataMgr::getGlobalFileMgr ( ) const

Definition at line 609 of file DataMgr.cpp.

References bufferMgrs_, and CHECK.

Referenced by convertDB(), createTopLevelMetadata(), TableArchiver::dumpTable(), anonymous_namespace{DdlCommandExecutor.cpp}::get_agg_storage_stats(), getTableEpoch(), foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable(), resetTableEpochFloor(), TableArchiver::restoreTable(), setTableEpoch(), and TableOptimizer::vacuumDeletedRows().

609  {
610  File_Namespace::GlobalFileMgr* global_file_mgr{nullptr};
611  global_file_mgr =
612  dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
613  CHECK(global_file_mgr);
614  return global_file_mgr;
615 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

Buffer_Namespace::GpuCudaBufferMgr * Data_Namespace::DataMgr::getGpuBufferMgr ( int32_t  device_id) const

Definition at line 646 of file DataMgr.cpp.

References bufferMgrs_, CHECK_GT, and Data_Namespace::GPU_LEVEL.

646  {
647  if (bufferMgrs_.size() > MemoryLevel::GPU_LEVEL) {
648  CHECK_GT(bufferMgrs_[MemoryLevel::GPU_LEVEL].size(), static_cast<size_t>(device_id));
649  return dynamic_cast<Buffer_Namespace::GpuCudaBufferMgr*>(
650  bufferMgrs_[MemoryLevel::GPU_LEVEL][device_id]);
651  } else {
652  return nullptr;
653  }
654 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
#define CHECK_GT(x, y)
Definition: Logger.h:235
std::vector< MemoryInfo > Data_Namespace::DataMgr::getMemoryInfo ( const MemoryLevel  memLevel) const

Definition at line 352 of file DataMgr.cpp.

References buffer_access_mutex_, and getMemoryInfoUnlocked().

Referenced by Executor::createKernels().

352  {
353  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
354  return getMemoryInfoUnlocked(mem_level);
355 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< MemoryInfo > getMemoryInfoUnlocked(const MemoryLevel memLevel) const
Definition: DataMgr.cpp:357

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< MemoryInfo > Data_Namespace::DataMgr::getMemoryInfoUnlocked ( const MemoryLevel  memLevel) const

Definition at line 357 of file DataMgr.cpp.

References bufferMgrs_, CHECK, Data_Namespace::MemoryData::chunk_key, Data_Namespace::CPU_LEVEL, cudaMgr_, Buffer_Namespace::BufferMgr::getAllocated(), Buffer_Namespace::BufferMgr::getMaxSize(), Buffer_Namespace::BufferMgr::getPageSize(), Buffer_Namespace::BufferMgr::getSlabSegments(), Data_Namespace::GPU_LEVEL, hasGpus_, Data_Namespace::MemoryInfo::isAllocationCapped, Buffer_Namespace::BufferMgr::isAllocationCapped(), Data_Namespace::MemoryInfo::maxNumPages, Data_Namespace::MemoryData::memStatus, Data_Namespace::MemoryInfo::nodeMemoryData, Data_Namespace::MemoryInfo::numPageAllocated, Data_Namespace::MemoryData::numPages, Data_Namespace::MemoryInfo::pageSize, Data_Namespace::MemoryData::slabNum, Data_Namespace::MemoryData::startPage, and Data_Namespace::MemoryData::touch.

Referenced by getMemoryInfo().

358  {
359  std::vector<MemoryInfo> mem_info;
360  if (mem_level == MemoryLevel::CPU_LEVEL) {
361  Buffer_Namespace::CpuBufferMgr* cpu_buffer =
362  dynamic_cast<Buffer_Namespace::CpuBufferMgr*>(
364  CHECK(cpu_buffer);
365  MemoryInfo mi;
366 
367  mi.pageSize = cpu_buffer->getPageSize();
368  mi.maxNumPages = cpu_buffer->getMaxSize() / mi.pageSize;
369  mi.isAllocationCapped = cpu_buffer->isAllocationCapped();
370  mi.numPageAllocated = cpu_buffer->getAllocated() / mi.pageSize;
371 
372  const auto& slab_segments = cpu_buffer->getSlabSegments();
373  for (size_t slab_num = 0; slab_num < slab_segments.size(); ++slab_num) {
374  for (auto segment : slab_segments[slab_num]) {
375  MemoryData md;
376  md.slabNum = slab_num;
377  md.startPage = segment.start_page;
378  md.numPages = segment.num_pages;
379  md.touch = segment.last_touched;
380  md.memStatus = segment.mem_status;
381  md.chunk_key.insert(
382  md.chunk_key.end(), segment.chunk_key.begin(), segment.chunk_key.end());
383  mi.nodeMemoryData.push_back(md);
384  }
385  }
386  mem_info.push_back(mi);
387  } else if (hasGpus_) {
388  int numGpus = cudaMgr_->getDeviceCount();
389  for (int gpuNum = 0; gpuNum < numGpus; ++gpuNum) {
391  dynamic_cast<Buffer_Namespace::GpuCudaBufferMgr*>(
393  CHECK(gpu_buffer);
394  MemoryInfo mi;
395 
396  mi.pageSize = gpu_buffer->getPageSize();
397  mi.maxNumPages = gpu_buffer->getMaxSize() / mi.pageSize;
398  mi.isAllocationCapped = gpu_buffer->isAllocationCapped();
399  mi.numPageAllocated = gpu_buffer->getAllocated() / mi.pageSize;
400 
401  const auto& slab_segments = gpu_buffer->getSlabSegments();
402  for (size_t slab_num = 0; slab_num < slab_segments.size(); ++slab_num) {
403  for (auto segment : slab_segments[slab_num]) {
404  MemoryData md;
405  md.slabNum = slab_num;
406  md.startPage = segment.start_page;
407  md.numPages = segment.num_pages;
408  md.touch = segment.last_touched;
409  md.chunk_key.insert(
410  md.chunk_key.end(), segment.chunk_key.begin(), segment.chunk_key.end());
411  md.memStatus = segment.mem_status;
412  mi.nodeMemoryData.push_back(md);
413  }
414  }
415  mem_info.push_back(mi);
416  }
417  }
418  return mem_info;
419 }
size_t getAllocated() override
Definition: BufferMgr.cpp:500
std::vector< MemoryData > nodeMemoryData
Definition: DataMgr.h:74
Buffer_Namespace::MemStatus memStatus
Definition: DataMgr.h:66
size_t getMaxSize() override
Definition: BufferMgr.cpp:495
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
bool isAllocationCapped() override
Definition: BufferMgr.cpp:505
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271
const std::vector< BufferList > & getSlabSegments()
Definition: BufferMgr.cpp:886
#define CHECK(condition)
Definition: Logger.h:223
std::vector< int32_t > chunk_key
Definition: DataMgr.h:65

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PersistentStorageMgr * Data_Namespace::DataMgr::getPersistentStorageMgr ( ) const

Definition at line 637 of file DataMgr.cpp.

References bufferMgrs_, and Data_Namespace::DISK_LEVEL.

Referenced by RelAlgExecutor::initializeParallelismHints(), and anonymous_namespace{RelAlgExecutor.cpp}::set_parallelism_hints().

637  {
638  return dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[MemoryLevel::DISK_LEVEL][0]);
639 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

DataMgr::SystemMemoryUsage Data_Namespace::DataMgr::getSystemMemoryUsage ( ) const

Definition at line 92 of file DataMgr.cpp.

References Data_Namespace::DataMgr::SystemMemoryUsage::frag, Data_Namespace::DataMgr::SystemMemoryUsage::free, Data_Namespace::ProcBuddyinfoParser::getFragmentationPercent(), Data_Namespace::DataMgr::SystemMemoryUsage::regular, Data_Namespace::DataMgr::SystemMemoryUsage::resident, Data_Namespace::DataMgr::SystemMemoryUsage::shared, Data_Namespace::DataMgr::SystemMemoryUsage::total, and Data_Namespace::DataMgr::SystemMemoryUsage::vtotal.

92  {
93  SystemMemoryUsage usage;
94 
95 #ifdef __linux__
96 
97  // Determine Linux available memory and total memory.
98  // Available memory is different from free memory because
99  // when Linux sees free memory, it tries to use it for
100  // stuff like disk caching. However, the memory is not
101  // reserved and is still available to be allocated by
102  // user processes.
103  // Parsing /proc/meminfo for this info isn't very elegant
104  // but as a virtual file it should be reasonably fast.
105  // See also:
106  // https://github.com/torvalds/linux/commit/34e431b0ae398fc54ea69ff85ec700722c9da773
108  usage.free = mi["MemAvailable"];
109  usage.total = mi["MemTotal"];
110 
111  // Determine process memory in use.
112  // See also:
113  // https://stackoverflow.com/questions/669438/how-to-get-memory-usage-at-runtime-using-c
114  // http://man7.org/linux/man-pages/man5/proc.5.html
115  int64_t size = 0;
116  int64_t resident = 0;
117  int64_t shared = 0;
118 
119  std::ifstream fstatm("/proc/self/statm");
120  fstatm >> size >> resident >> shared;
121  fstatm.close();
122 
123  long page_size =
124  sysconf(_SC_PAGE_SIZE); // in case x86-64 is configured to use 2MB pages
125 
126  usage.resident = resident * page_size;
127  usage.vtotal = size * page_size;
128  usage.regular = (resident - shared) * page_size;
129  usage.shared = shared * page_size;
130 
132  usage.frag = bi.getFragmentationPercent();
133 
134 #else
135 
136  usage.total = 0;
137  usage.free = 0;
138  usage.resident = 0;
139  usage.vtotal = 0;
140  usage.regular = 0;
141  usage.shared = 0;
142  usage.frag = 0;
143 
144 #endif
145 
146  return usage;
147 }
Parse /proc/meminfo into key/value pairs.
Definition: DataMgr.h:78
Parse /proc/buddyinfo into a Fragmentation health score.
Definition: DataMgr.h:111

+ Here is the call graph for this function:

size_t Data_Namespace::DataMgr::getTableEpoch ( const int  db_id,
const int  tb_id 
)

Definition at line 595 of file DataMgr.cpp.

References bufferMgrs_, CHECK, and getGlobalFileMgr().

595  {
596  File_Namespace::GlobalFileMgr* gfm{nullptr};
597  gfm = dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
598  CHECK(gfm);
599  return gfm->getTableEpoch(db_id, tb_id);
600 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

size_t Data_Namespace::DataMgr::getTotalSystemMemory ( )
static

Definition at line 149 of file DataMgr.cpp.

Referenced by populateMgrs().

149  {
150 #ifdef __APPLE__
151  int mib[2];
152  size_t physical_memory;
153  size_t length;
154  // Get the Physical memory size
155  mib[0] = CTL_HW;
156  mib[1] = HW_MEMSIZE;
157  length = sizeof(size_t);
158  sysctl(mib, 2, &physical_memory, &length, NULL, 0);
159  return physical_memory;
160 #elif defined(_MSC_VER)
161  MEMORYSTATUSEX status;
162  status.dwLength = sizeof(status);
163  GlobalMemoryStatusEx(&status);
164  return status.ullTotalPhys;
165 #else // Linux
166  long pages = sysconf(_SC_PHYS_PAGES);
167  long page_size = sysconf(_SC_PAGE_SIZE);
168  return pages * page_size;
169 #endif
170 }

+ Here is the caller graph for this function:

bool Data_Namespace::DataMgr::gpusPresent ( ) const
inline

Definition at line 216 of file DataMgr.h.

References hasGpus_.

Referenced by get_available_gpus().

216 { return hasGpus_; }

+ Here is the caller graph for this function:

bool Data_Namespace::DataMgr::isBufferOnDevice ( const ChunkKey key,
const MemoryLevel  memLevel,
const int  deviceId 
)

Definition at line 462 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

Referenced by Chunk_NS::Chunk::isChunkOnDevice().

464  {
465  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
466  return bufferMgrs_[memLevel][deviceId]->isBufferOnDevice(key);
467 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::populateMgrs ( const SystemParameters system_parameters,
const size_t  userSpecifiedNumReaderThreads,
const File_Namespace::DiskCacheConfig cache_config 
)
private

Definition at line 216 of file DataMgr.cpp.

References allocateCpuBufferMgr(), bufferMgrs_, SystemParameters::cpu_buffer_mem_bytes, cudaMgr_, dataDir_, Data_Namespace::DRAM, g_pmem_size, getTotalSystemMemory(), SystemParameters::gpu_buffer_mem_bytes, hasGpus_, logger::INFO, levelSizes_, LOG, SystemParameters::max_cpu_slab_size, SystemParameters::max_gpu_slab_size, SystemParameters::min_cpu_slab_size, SystemParameters::min_gpu_slab_size, Data_Namespace::numCpuTiers, Data_Namespace::PMEM, reservedGpuMem_, and VLOG.

Referenced by resetPersistentStorage().

218  {
219  // no need for locking, as this is only called in the constructor
220  bufferMgrs_.resize(2);
221  bufferMgrs_[0].push_back(
222  new PersistentStorageMgr(dataDir_, userSpecifiedNumReaderThreads, cache_config));
223 
224  levelSizes_.push_back(1);
225  size_t page_size{512};
226  size_t cpuBufferSize = system_parameters.cpu_buffer_mem_bytes;
227  if (cpuBufferSize == 0) { // if size is not specified
228  const auto total_system_memory = getTotalSystemMemory();
229  VLOG(1) << "Detected " << (float)total_system_memory / (1024 * 1024)
230  << "M of total system memory.";
231  cpuBufferSize = total_system_memory *
232  0.8; // should get free memory instead of this ugly heuristic
233  }
234  size_t minCpuSlabSize = std::min(system_parameters.min_cpu_slab_size, cpuBufferSize);
235  minCpuSlabSize = (minCpuSlabSize / page_size) * page_size;
236  size_t maxCpuSlabSize = std::min(system_parameters.max_cpu_slab_size, cpuBufferSize);
237  maxCpuSlabSize = (maxCpuSlabSize / page_size) * page_size;
238  LOG(INFO) << "Min CPU Slab Size is " << (float)minCpuSlabSize / (1024 * 1024) << "MB";
239  LOG(INFO) << "Max CPU Slab Size is " << (float)maxCpuSlabSize / (1024 * 1024) << "MB";
240  LOG(INFO) << "Max memory pool size for CPU is " << (float)cpuBufferSize / (1024 * 1024)
241  << "MB";
242 
243  size_t total_cpu_size = 0;
244 
245 #ifdef ENABLE_MEMKIND
246  CpuTierSizeVector cpu_tier_sizes(numCpuTiers, 0);
247  cpu_tier_sizes[CpuTier::DRAM] = cpuBufferSize;
248  if (g_enable_tiered_cpu_mem) {
249  cpu_tier_sizes[CpuTier::PMEM] = g_pmem_size;
250  LOG(INFO) << "Max memory pool size for PMEM is " << (float)g_pmem_size / (1024 * 1024)
251  << "MB";
252  }
253  for (auto cpu_tier_size : cpu_tier_sizes) {
254  total_cpu_size += cpu_tier_size;
255  }
256 #else
257  CpuTierSizeVector cpu_tier_sizes{};
258  total_cpu_size = cpuBufferSize;
259 #endif
260 
261  if (hasGpus_ || cudaMgr_) {
262  LOG(INFO) << "Reserved GPU memory is " << (float)reservedGpuMem_ / (1024 * 1024)
263  << "MB includes render buffer allocation";
264  bufferMgrs_.resize(3);
266  0, total_cpu_size, minCpuSlabSize, maxCpuSlabSize, page_size, cpu_tier_sizes);
267 
268  levelSizes_.push_back(1);
269  int numGpus = cudaMgr_->getDeviceCount();
270  for (int gpuNum = 0; gpuNum < numGpus; ++gpuNum) {
271  size_t gpuMaxMemSize =
272  system_parameters.gpu_buffer_mem_bytes != 0
273  ? system_parameters.gpu_buffer_mem_bytes
274  : (cudaMgr_->getDeviceProperties(gpuNum)->globalMem) - (reservedGpuMem_);
275  size_t minGpuSlabSize =
276  std::min(system_parameters.min_gpu_slab_size, gpuMaxMemSize);
277  minGpuSlabSize = (minGpuSlabSize / page_size) * page_size;
278  size_t maxGpuSlabSize =
279  std::min(system_parameters.max_gpu_slab_size, gpuMaxMemSize);
280  maxGpuSlabSize = (maxGpuSlabSize / page_size) * page_size;
281  LOG(INFO) << "Min GPU Slab size for GPU " << gpuNum << " is "
282  << (float)minGpuSlabSize / (1024 * 1024) << "MB";
283  LOG(INFO) << "Max GPU Slab size for GPU " << gpuNum << " is "
284  << (float)maxGpuSlabSize / (1024 * 1024) << "MB";
285  LOG(INFO) << "Max memory pool size for GPU " << gpuNum << " is "
286  << (float)gpuMaxMemSize / (1024 * 1024) << "MB";
287  bufferMgrs_[2].push_back(new Buffer_Namespace::GpuCudaBufferMgr(gpuNum,
288  gpuMaxMemSize,
289  cudaMgr_.get(),
290  minGpuSlabSize,
291  maxGpuSlabSize,
292  page_size,
293  bufferMgrs_[1][0]));
294  }
295  levelSizes_.push_back(numGpus);
296  } else {
298  0, total_cpu_size, minCpuSlabSize, maxCpuSlabSize, page_size, cpu_tier_sizes);
299  levelSizes_.push_back(1);
300  }
301 }
size_t g_pmem_size
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
std::vector< int > levelSizes_
Definition: DataMgr.h:227
#define LOG(tag)
Definition: Logger.h:217
constexpr size_t numCpuTiers
static size_t getTotalSystemMemory()
Definition: DataMgr.cpp:149
std::unique_ptr< CudaMgr_Namespace::CudaMgr > cudaMgr_
Definition: DataMgr.h:271
void allocateCpuBufferMgr(int32_t device_id, size_t total_cpu_size, size_t minCpuSlabSize, size_t maxCpuSlabSize, size_t page_size, const std::vector< size_t > &cpu_tier_sizes)
Definition: DataMgr.cpp:172
std::vector< size_t > CpuTierSizeVector
#define VLOG(n)
Definition: Logger.h:317
std::string dataDir_
Definition: DataMgr.h:272

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Data_Namespace::DataMgr::removeTableRelatedDS ( const int  db_id,
const int  tb_id 
)

Definition at line 583 of file DataMgr.cpp.

References buffer_access_mutex_, and bufferMgrs_.

583  {
584  std::lock_guard<std::mutex> buffer_lock(buffer_access_mutex_);
585  bufferMgrs_[0][0]->removeTableRelatedDS(db_id, tb_id);
586 }
std::mutex buffer_access_mutex_
Definition: DataMgr.h:275
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
void Data_Namespace::DataMgr::resetPersistentStorage ( const File_Namespace::DiskCacheConfig cache_config,
const size_t  num_reader_threads,
const SystemParameters sys_params 
)

Definition at line 202 of file DataMgr.cpp.

References bufferMgrs_, createTopLevelMetadata(), and populateMgrs().

204  {
205  int numLevels = bufferMgrs_.size();
206  for (int level = numLevels - 1; level >= 0; --level) {
207  for (size_t device = 0; device < bufferMgrs_[level].size(); device++) {
208  delete bufferMgrs_[level][device];
209  }
210  }
211  bufferMgrs_.clear();
212  populateMgrs(sys_params, num_reader_threads, cache_config);
214 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
void createTopLevelMetadata() const
Definition: DataMgr.cpp:336
void populateMgrs(const SystemParameters &system_parameters, const size_t userSpecifiedNumReaderThreads, const File_Namespace::DiskCacheConfig &cache_config)
Definition: DataMgr.cpp:216

+ Here is the call graph for this function:

void Data_Namespace::DataMgr::resetTableEpochFloor ( const int32_t  db_id,
const int32_t  tb_id 
)

Definition at line 602 of file DataMgr.cpp.

References bufferMgrs_, CHECK, and getGlobalFileMgr().

602  {
603  File_Namespace::GlobalFileMgr* gfm{nullptr};
604  gfm = dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
605  CHECK(gfm);
606  gfm->resetTableEpochFloor(db_id, tb_id);
607 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

void Data_Namespace::DataMgr::setTableEpoch ( const int  db_id,
const int  tb_id,
const int  start_epoch 
)

Definition at line 588 of file DataMgr.cpp.

References bufferMgrs_, CHECK, and getGlobalFileMgr().

588  {
589  File_Namespace::GlobalFileMgr* gfm{nullptr};
590  gfm = dynamic_cast<PersistentStorageMgr*>(bufferMgrs_[0][0])->getGlobalFileMgr();
591  CHECK(gfm);
592  gfm->setTableEpoch(db_id, tb_id, start_epoch);
593 }
std::vector< std::vector< AbstractBufferMgr * > > bufferMgrs_
Definition: DataMgr.h:270
File_Namespace::GlobalFileMgr * getGlobalFileMgr() const
Definition: DataMgr.cpp:609
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class GlobalFileMgr
friend

Definition at line 173 of file DataMgr.h.

Member Data Documentation

std::mutex Data_Namespace::DataMgr::buffer_access_mutex_
mutableprivate
std::unique_ptr<CudaMgr_Namespace::CudaMgr> Data_Namespace::DataMgr::cudaMgr_
private
std::string Data_Namespace::DataMgr::dataDir_
private

Definition at line 272 of file DataMgr.h.

Referenced by populateMgrs().

bool Data_Namespace::DataMgr::hasGpus_
private

Definition at line 273 of file DataMgr.h.

Referenced by getMemoryInfoUnlocked(), gpusPresent(), and populateMgrs().

std::vector<int> Data_Namespace::DataMgr::levelSizes_

Definition at line 227 of file DataMgr.h.

Referenced by alloc(), checkpoint(), deleteChunksWithPrefix(), getChunkBuffer(), and populateMgrs().

size_t Data_Namespace::DataMgr::reservedGpuMem_
private

Definition at line 274 of file DataMgr.h.

Referenced by populateMgrs().


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