OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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,
ChunkMetadataMap
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 ( )
inline

Definition at line 44 of file UpdelRoll.h.

References cancelUpdate(), and dirtyChunks.

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

+ Here is the call graph for this function:

Member Function Documentation

void UpdelRoll::cancelUpdate ( )

Definition at line 1335 of file UpdelStorage.cpp.

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

Referenced by ~UpdelRoll().

1335  {
1336  if (nullptr == catalog) {
1337  return;
1338  }
1339 
1340  if (is_varlen_update) {
1341  int databaseId = catalog->getCurrentDB().dbId;
1342  int32_t tableEpoch = catalog->getTableEpoch(databaseId, logicalTableId);
1343 
1344  dirtyChunks.clear();
1345  const_cast<Catalog_Namespace::Catalog*>(catalog)->setTableEpoch(
1346  databaseId, logicalTableId, tableEpoch);
1347  } else {
1348  const auto td = catalog->getMetadataForTable(logicalTableId);
1349  CHECK(td);
1350  if (td->persistenceLevel != memoryLevel) {
1351  for (auto dit : dirtyChunks) {
1352  catalog->getDataMgr().free(dit.first->getBuffer());
1353  dit.first->setBuffer(nullptr);
1354  }
1355  }
1356  }
1357 }
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:86
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:195
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:2688
CHECK(cgen_state)
const Catalog_Namespace::Catalog * catalog
Definition: UpdelRoll.h:63
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:194
int logicalTableId
Definition: UpdelRoll.h:64
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:461

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UpdelRoll::commitUpdate ( )

Definition at line 1311 of file UpdelStorage.cpp.

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

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

1311  {
1312  if (nullptr == catalog) {
1313  return;
1314  }
1315  const auto td = catalog->getMetadataForTable(logicalTableId);
1316  CHECK(td);
1317  // checkpoint all shards regardless, or epoch becomes out of sync
1318  if (td->persistenceLevel == Data_Namespace::MemoryLevel::DISK_LEVEL) {
1320  }
1321  // for each dirty fragment
1322  for (auto& cm : chunkMetadata) {
1323  cm.first.first->fragmenter->updateMetadata(catalog, cm.first, *this);
1324  }
1325  dirtyChunks.clear();
1326  // flush gpu dirty chunks if update was not on gpu
1328  for (const auto& chunkey : dirtyChunkeys) {
1331  }
1332  }
1333 }
Data_Namespace::MemoryLevel memoryLevel
Definition: UpdelRoll.h:65
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:195
std::map< Chunk_NS::Chunk *, std::shared_ptr< Chunk_NS::Chunk > > dirtyChunks
Definition: UpdelRoll.h:52
std::set< ChunkKey > dirtyChunkeys
Definition: UpdelRoll.h:53
CHECK(cgen_state)
const Catalog_Namespace::Catalog * catalog
Definition: UpdelRoll.h:63
void checkpoint(const int logicalTableId) const
Definition: Catalog.cpp:3598
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
Definition: DataMgr.cpp:428
int logicalTableId
Definition: UpdelRoll.h:64
std::map< MetaDataKey, ChunkMetadataMap > chunkMetadata
Definition: UpdelRoll.h:59
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool UpdelRoll::is_varlen_update = false

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