OmniSciDB  29e35f4d58
UpdelRoll Struct Reference

#include <UpdelRoll.h>

+ Collaboration diagram for UpdelRoll:

Public Member Functions

 ~UpdelRoll ()
 
void cancelUpdate ()
 
void commitUpdate ()
 

Public Attributes

std::mutex mutex
 
std::map< Chunk_NS::Chunk *, std::shared_ptr< Chunk_NS::Chunk > > dirtyChunks
 
std::set< ChunkKeydirtyChunkeys
 
std::map< MetaDataKey, size_t > numTuples
 
std::map< MetaDataKey, std::map< int, ChunkMetadata > > chunkMetadata
 
const Catalog_Namespace::Catalogcatalog = nullptr
 
int logicalTableId
 
Data_Namespace::MemoryLevel memoryLevel {Data_Namespace::MemoryLevel::CPU_LEVEL}
 
bool is_varlen_update = false
 

Detailed Description

Definition at line 43 of file UpdelRoll.h.

Constructor & Destructor Documentation

◆ ~UpdelRoll()

UpdelRoll::~UpdelRoll ( )
inline

Definition at line 44 of file UpdelRoll.h.

44  {
45  if (dirtyChunks.size()) {
46  cancelUpdate();
47  }
48  }
void cancelUpdate()
std::map< Chunk_NS::Chunk *, std::shared_ptr< Chunk_NS::Chunk > > dirtyChunks
Definition: UpdelRoll.h:52

Member Function Documentation

◆ cancelUpdate()

void UpdelRoll::cancelUpdate ( )

Definition at line 1359 of file UpdelStorage.cpp.

References CHECK, and Catalog_Namespace::Catalog::getMetadataForTable().

1359  {
1360  if (nullptr == catalog) {
1361  return;
1362  }
1363 
1364  if (is_varlen_update) {
1365  int databaseId = catalog->getCurrentDB().dbId;
1366  int32_t tableEpoch = catalog->getTableEpoch(databaseId, logicalTableId);
1367 
1368  dirtyChunks.clear();
1369  const_cast<Catalog_Namespace::Catalog*>(catalog)->setTableEpoch(
1370  databaseId, logicalTableId, tableEpoch);
1371  } else {
1372  const auto td = catalog->getMetadataForTable(logicalTableId);
1373  CHECK(td);
1374  if (td->persistenceLevel != memoryLevel) {
1375  for (auto dit : dirtyChunks) {
1376  catalog->getDataMgr().free(dit.first->get_buffer());
1377  dit.first->set_buffer(nullptr);
1378  }
1379  }
1380  }
1381 }
Data_Namespace::MemoryLevel memoryLevel
Definition: UpdelRoll.h:65
bool is_varlen_update
Definition: UpdelRoll.h:67
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:81
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:177
std::map< Chunk_NS::Chunk *, std::shared_ptr< Chunk_NS::Chunk > > dirtyChunks
Definition: UpdelRoll.h:52
int32_t getTableEpoch(const int32_t db_id, const int32_t table_id) const
Definition: Catalog.cpp:2257
const Catalog_Namespace::Catalog * catalog
Definition: UpdelRoll.h:63
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:176
int logicalTableId
Definition: UpdelRoll.h:64
#define CHECK(condition)
Definition: Logger.h:193
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:382
+ Here is the call graph for this function:

◆ commitUpdate()

void UpdelRoll::commitUpdate ( )

Definition at line 1335 of file UpdelStorage.cpp.

References CHECK, Data_Namespace::DISK_LEVEL, and Data_Namespace::GPU_LEVEL.

Referenced by Catalog_Namespace::Catalog::vacuumDeletedRows().

1335  {
1336  if (nullptr == catalog) {
1337  return;
1338  }
1339  const auto td = catalog->getMetadataForTable(logicalTableId);
1340  CHECK(td);
1341  // checkpoint all shards regardless, or epoch becomes out of sync
1342  if (td->persistenceLevel == Data_Namespace::MemoryLevel::DISK_LEVEL) {
1344  }
1345  // for each dirty fragment
1346  for (auto& cm : chunkMetadata) {
1347  cm.first.first->fragmenter->updateMetadata(catalog, cm.first, *this);
1348  }
1349  dirtyChunks.clear();
1350  // flush gpu dirty chunks if update was not on gpu
1352  for (const auto& chunkey : dirtyChunkeys) {
1355  }
1356  }
1357 }
Data_Namespace::MemoryLevel memoryLevel
Definition: UpdelRoll.h:65
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:177
std::map< Chunk_NS::Chunk *, std::shared_ptr< Chunk_NS::Chunk > > dirtyChunks
Definition: UpdelRoll.h:52
std::set< ChunkKey > dirtyChunkeys
Definition: UpdelRoll.h:53
void checkpoint(const int logicalTableId) const
Definition: Catalog.cpp:3074
const Catalog_Namespace::Catalog * catalog
Definition: UpdelRoll.h:63
std::map< MetaDataKey, std::map< int, ChunkMetadata > > chunkMetadata
Definition: UpdelRoll.h:59
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
Definition: DataMgr.cpp:354
int logicalTableId
Definition: UpdelRoll.h:64
#define CHECK(condition)
Definition: Logger.h:193
+ Here is the caller graph for this function:

Member Data Documentation

◆ catalog

◆ chunkMetadata

◆ dirtyChunkeys

◆ dirtyChunks

◆ is_varlen_update

bool UpdelRoll::is_varlen_update = false

◆ logicalTableId

◆ memoryLevel

◆ mutex

◆ numTuples


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