|
MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
多版本并发事务TODO 没有垃圾回收 更多...
#include <mvcc_trx.h>
Public 成员函数 | |
| MvccTrx (MvccTrxKit &trx_kit, LogHandler &log_handler) | |
| 构造函数 更多... | |
| MvccTrx (MvccTrxKit &trx_kit, LogHandler &log_handler, int32_t trx_id) | |
| RC | insert_record (Table *table, Record &record) override |
| RC | delete_record (Table *table, Record &record) override |
| RC | update_record (Table *table, Record &old_record, Record &new_record) override |
| RC | visit_record (Table *table, Record &record, ReadWriteMode mode) override |
| 当访问到某条数据时,使用此函数来判断是否可见,或者是否有访问冲突 更多... | |
| RC | start_if_need () override |
| RC | commit () override |
| RC | rollback () override |
| RC | redo (Db *db, const LogEntry &log_entry) override |
| int32_t | id () const override |
Public 成员函数 继承自 Trx | |
| Trx (TrxKit::Type type) | |
| virtual RC | insert_record (Table *table, Record &record)=0 |
| virtual RC | delete_record (Table *table, Record &record)=0 |
| virtual RC | update_record (Table *table, Record &old_record, Record &new_record)=0 |
| virtual RC | visit_record (Table *table, Record &record, ReadWriteMode mode)=0 |
| virtual RC | start_if_need ()=0 |
| virtual RC | commit ()=0 |
| virtual RC | rollback ()=0 |
| virtual RC | redo (Db *db, const LogEntry &log_entry)=0 |
| virtual int32_t | id () const =0 |
| TrxKit::Type | type () const |
Private 类型 | |
| using | OperationSet = vector< Operation > |
Private 成员函数 | |
| RC | commit_with_trx_id (int32_t commit_id) |
| void | trx_fields (Table *table, Field &begin_xid_field, Field &end_xid_field) const |
| 获取指定表上的事务使用的字段 更多... | |
Private 属性 | |
| MvccTrxKit & | trx_kit_ |
| MvccTrxLogHandler | log_handler_ |
| int32_t | trx_id_ = -1 |
| bool | started_ = false |
| bool | recovering_ = false |
| OperationSet | operations_ |
静态 Private 属性 | |
| static const int32_t | MAX_TRX_ID = numeric_limits<int32_t>::max() |
多版本并发事务
TODO 没有垃圾回收
| MvccTrx::MvccTrx | ( | MvccTrxKit & | trx_kit, |
| LogHandler & | log_handler | ||
| ) |
构造函数
|
overridevirtual |
实现了 Trx.
|
inlineoverridevirtual |
实现了 Trx.
|
overridevirtual |
实现了 Trx.
|
overridevirtual |
实现了 Trx.
|
private |
获取指定表上的事务使用的字段
| table | 指定的表 |
| begin_xid_field | 返回处理begin_xid的字段 |
| end_xid_field | 返回处理end_xid的字段 |
|
inlineoverridevirtual |
实现了 Trx.
当访问到某条数据时,使用此函数来判断是否可见,或者是否有访问冲突
| table | 要访问的数据属于哪张表 |
| record | 要访问哪条数据 |
| mode | 是否只读访问 |
实现了 Trx.