10class SequenceCatalogEntry;
11struct SequenceRollbackData;
22struct VectorUpdateInfo;
23class ChunkedNodeGroup;
25namespace transaction {
26class TransactionManager;
62 forceCheckpoint =
true;
72 void commit(storage::WAL* wal)
const;
78 return maxCommittedNodeOffsets.contains(tableID);
81 maxCommittedNodeOffsets[tableID] = offset;
99 return minUncommittedNodeOffsets.contains(tableID) ? minUncommittedNodeOffsets.at(tableID) :
103 KU_ASSERT(maxCommittedNodeOffsets.contains(tableID));
104 return maxCommittedNodeOffsets.at(tableID);
108 KU_ASSERT(maxCommittedNodeOffsets.contains(tableID));
109 return maxCommittedNodeOffsets.at(tableID) +
getLocalRowIdx(tableID, uncommittedOffset);
112 void pushCatalogEntry(catalog::CatalogSet& catalogSet, catalog::CatalogEntry& catalogEntry,
113 bool skipLoggingToWAL =
false)
const;
115 const catalog::SequenceRollbackData& data)
const;
121 storage::VectorUpdateInfo& vectorUpdateInfo)
const;
128 std::unordered_map<common::table_id_t, common::offset_t> minUncommittedNodeOffsets,
129 std::unordered_map<common::table_id_t, common::offset_t> maxCommittedNodeOffsets);
138 std::unique_ptr<storage::LocalStorage> localStorage;
139 std::unique_ptr<storage::UndoBuffer> undoBuffer;
140 bool forceCheckpoint;
145 std::unordered_map<common::table_id_t, common::offset_t> minUncommittedNodeOffsets;
149 std::unordered_map<common::table_id_t, common::offset_t> maxCommittedNodeOffsets;
#define KUZU_API
Definition api.h:25
#define KU_ASSERT(condition)
Definition assert.h:19
Contain client side configuration. We make profiler associated per query, so profiler is not maintain...
Definition client_context.h:57
Definition transaction.h:30
bool shouldForceCheckpoint() const
storage::LocalStorage * getLocalStorage() const
Definition transaction.h:76
void checkForceCheckpoint(common::StatementType statementType)
Definition transaction.h:59
common::transaction_t getStartTS() const
Definition transaction.h:54
void setMaxCommittedNodeOffset(common::table_id_t tableID, common::offset_t offset)
Definition transaction.h:80
common::row_idx_t getLocalRowIdx(common::table_id_t tableID, common::offset_t nodeOffset) const
Definition transaction.h:86
Transaction(TransactionType transactionType) noexcept
Transaction(main::ClientContext &clientContext, TransactionType transactionType, common::transaction_t transactionID, common::transaction_t startTS)
bool hasNewlyInsertedNodes(common::table_id_t tableID) const
Definition transaction.h:77
void pushInsertInfo(storage::ChunkedNodeGroup *chunkedNodeGroup, common::row_idx_t startRow, common::row_idx_t numRows) const
bool isRecovery() const
Definition transaction.h:52
Transaction(TransactionType transactionType, common::transaction_t ID, common::transaction_t startTS) noexcept
common::offset_t getMinUncommittedNodeOffset(common::table_id_t tableID) const
Definition transaction.h:95
bool isUnCommitted(common::table_id_t tableID, common::offset_t nodeOffset) const
Definition transaction.h:83
common::transaction_t getCommitTS() const
Definition transaction.h:55
void pushDeleteInfo(storage::ChunkedNodeGroup *chunkedNodeGroup, common::row_idx_t startRow, common::row_idx_t numRows) const
void pushCatalogEntry(catalog::CatalogSet &catalogSet, catalog::CatalogEntry &catalogEntry, bool skipLoggingToWAL=false) const
bool shouldAppendToUndoBuffer() const
Definition transaction.h:65
bool isWriteTransaction() const
Definition transaction.h:50
bool shouldLogToWAL() const
static constexpr common::transaction_t DUMMY_TRANSACTION_ID
Definition transaction.h:34
TransactionType getType() const
Definition transaction.h:48
common::offset_t getUncommittedOffset(common::table_id_t tableID, common::row_idx_t localRowIdx) const
Definition transaction.h:91
void pushVectorUpdateInfo(storage::UpdateInfo &updateInfo, common::idx_t vectorIdx, storage::VectorUpdateInfo &vectorUpdateInfo) const
common::offset_t getCommittedOffsetFromUncommitted(common::table_id_t tableID, common::offset_t uncommittedOffset) const
Definition transaction.h:106
static constexpr common::transaction_t DUMMY_START_TIMESTAMP
Definition transaction.h:35
main::ClientContext * getClientContext() const
Definition transaction.h:57
void commit(storage::WAL *wal) const
common::transaction_t getID() const
Definition transaction.h:53
void pushSequenceChange(catalog::SequenceCatalogEntry *sequenceEntry, int64_t kCount, const catalog::SequenceRollbackData &data) const
friend class TransactionManager
Definition transaction.h:31
bool isReadOnly() const
Definition transaction.h:49
void rollback(storage::WAL *wal) const
static constexpr common::transaction_t START_TRANSACTION_ID
Definition transaction.h:36
static Transaction getDummyTransactionFromExistingOne(const Transaction &other)
int64_t getCurrentTS() const
Definition transaction.h:56
bool isDummy() const
Definition transaction.h:51
common::offset_t getMaxCommittedNodeOffset(common::table_id_t tableID) const
Definition transaction.h:102
uint64_t getEstimatedMemUsage() const
uint32_t idx_t
Definition types.h:41
uint64_t transaction_t
Definition types.h:61
oid_t table_id_t
Definition types.h:67
uint64_t offset_t
Definition types.h:74
uint64_t row_idx_t
Definition types.h:48
StatementType
Definition statement_type.h:8
TransactionType
Definition transaction.h:28
KUZU_API Transaction DUMMY_CHECKPOINT_TRANSACTION
KUZU_API Transaction DUMMY_TRANSACTION
Definition array_utils.h:7