OmniSciDB  04ee39c94c
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 1330 of file UpdelStorage.cpp.

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

1330  {
1331  if (nullptr == catalog) {
1332  return;
1333  }
1334 
1335  if (is_varlen_update) {
1336  int databaseId = catalog->getCurrentDB().dbId;
1337  int32_t tableEpoch = catalog->getTableEpoch(databaseId, logicalTableId);
1338 
1339  dirtyChunks.clear();
1340  const_cast<Catalog_Namespace::Catalog*>(catalog)->setTableEpoch(
1341  databaseId, logicalTableId, tableEpoch);
1342  } else {
1343  const auto td = catalog->getMetadataForTable(logicalTableId);
1344  CHECK(td);
1345  if (td->persistenceLevel != memoryLevel) {
1346  for (auto dit : dirtyChunks) {
1347  catalog->getDataMgr().free(dit.first->get_buffer());
1348  dit.first->set_buffer(nullptr);
1349  }
1350  }
1351  }
1352 }
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:2123
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:187
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:382
+ Here is the call graph for this function:

◆ commitUpdate()

void UpdelRoll::commitUpdate ( )

Definition at line 1306 of file UpdelStorage.cpp.

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

Referenced by anonymous_namespace{UpdelStorageTest.cpp}::delete_and_immediately_vacuum_rows(), anonymous_namespace{UpdelStorageTest.cpp}::prepare_table_for_delete(), anonymous_namespace{UpdelStorageTest.cpp}::update_common(), and Catalog_Namespace::Catalog::vacuumDeletedRows().

1306  {
1307  if (nullptr == catalog) {
1308  return;
1309  }
1310  const auto td = catalog->getMetadataForTable(logicalTableId);
1311  CHECK(td);
1312  // checkpoint all shards regardless, or epoch becomes out of sync
1313  if (td->persistenceLevel == Data_Namespace::MemoryLevel::DISK_LEVEL) {
1315  }
1316  // for each dirty fragment
1317  for (auto& cm : chunkMetadata) {
1318  cm.first.first->fragmenter->updateMetadata(catalog, cm.first, *this);
1319  }
1320  dirtyChunks.clear();
1321  // flush gpu dirty chunks if update was not on gpu
1323  for (const auto& chunkey : dirtyChunkeys) {
1326  }
1327  }
1328 }
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:2927
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:187
+ 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: