OmniSciDB  1dac507f6e
 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 1355 of file UpdelStorage.cpp.

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

Referenced by ~UpdelRoll().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UpdelRoll::commitUpdate ( )

Definition at line 1331 of file UpdelStorage.cpp.

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

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

1331  {
1332  if (nullptr == catalog) {
1333  return;
1334  }
1335  const auto td = catalog->getMetadataForTable(logicalTableId);
1336  CHECK(td);
1337  // checkpoint all shards regardless, or epoch becomes out of sync
1338  if (td->persistenceLevel == Data_Namespace::MemoryLevel::DISK_LEVEL) {
1340  }
1341  // for each dirty fragment
1342  for (auto& cm : chunkMetadata) {
1343  cm.first.first->fragmenter->updateMetadata(catalog, cm.first, *this);
1344  }
1345  dirtyChunks.clear();
1346  // flush gpu dirty chunks if update was not on gpu
1348  for (const auto& chunkey : dirtyChunkeys) {
1351  }
1352  }
1353 }
Data_Namespace::MemoryLevel memoryLevel
Definition: UpdelRoll.h:65
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
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:2929
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
Definition: DataMgr.cpp:354
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: