OmniSciDB  0fdbebe030
 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,
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 ( )
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 1353 of file UpdelStorage.cpp.

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

Referenced by ~UpdelRoll().

1353  {
1354  if (nullptr == catalog) {
1355  return;
1356  }
1357 
1358  if (is_varlen_update) {
1359  int databaseId = catalog->getCurrentDB().dbId;
1360  int32_t tableEpoch = catalog->getTableEpoch(databaseId, logicalTableId);
1361 
1362  dirtyChunks.clear();
1363  const_cast<Catalog_Namespace::Catalog*>(catalog)->setTableEpoch(
1364  databaseId, logicalTableId, tableEpoch);
1365  } else {
1366  const auto td = catalog->getMetadataForTable(logicalTableId);
1367  CHECK(td);
1368  if (td->persistenceLevel != memoryLevel) {
1369  for (auto dit : dirtyChunks) {
1370  catalog->getDataMgr().free(dit.first->get_buffer());
1371  dit.first->set_buffer(nullptr);
1372  }
1373  }
1374  }
1375 }
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:183
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:2485
CHECK(cgen_state)
const Catalog_Namespace::Catalog * catalog
Definition: UpdelRoll.h:63
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:182
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:443

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UpdelRoll::commitUpdate ( )

Definition at line 1329 of file UpdelStorage.cpp.

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

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

1329  {
1330  if (nullptr == catalog) {
1331  return;
1332  }
1333  const auto td = catalog->getMetadataForTable(logicalTableId);
1334  CHECK(td);
1335  // checkpoint all shards regardless, or epoch becomes out of sync
1336  if (td->persistenceLevel == Data_Namespace::MemoryLevel::DISK_LEVEL) {
1338  }
1339  // for each dirty fragment
1340  for (auto& cm : chunkMetadata) {
1341  cm.first.first->fragmenter->updateMetadata(catalog, cm.first, *this);
1342  }
1343  dirtyChunks.clear();
1344  // flush gpu dirty chunks if update was not on gpu
1346  for (const auto& chunkey : dirtyChunkeys) {
1349  }
1350  }
1351 }
Data_Namespace::MemoryLevel memoryLevel
Definition: UpdelRoll.h:65
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:183
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
std::map< MetaDataKey, std::map< int, ChunkMetadata > > chunkMetadata
Definition: UpdelRoll.h:59
void checkpoint(const int logicalTableId) const
Definition: Catalog.cpp:3357
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
Definition: DataMgr.cpp:415
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.

+ 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: