|
MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
B+树的扫描器 更多...
#include <bplus_tree.h>
Public 成员函数 | |
| BplusTreeScanner (BplusTreeHandler &tree_handler) | |
| RC | open (const char *left_user_key, int left_len, bool left_inclusive, const char *right_user_key, int right_len, bool right_inclusive) |
| 扫描指定范围的数据 更多... | |
| RC | next_entry (RID &rid) |
| RC | close () |
Private 成员函数 | |
| RC | fix_user_key (const char *user_key, int key_len, bool want_greater, char **fixed_key, bool *should_inclusive) |
| void | fetch_item (RID &rid) |
| bool | touch_end () |
Private 属性 | |
| bool | inited_ = false |
| BplusTreeHandler & | tree_handler_ |
| LatchMemo | latch_memo_ |
| Frame * | current_frame_ = nullptr |
| 使用左右叶子节点和位置来表示扫描的起始位置和终止位置 起始位置和终止位置都是有效的数据 | |
| common::MemPoolItem::unique_ptr | right_key_ |
| int | iter_index_ = -1 |
| bool | first_emitted_ = false |
B+树的扫描器
|
private |
如果key的类型是CHARS, 扩展或缩减user_key的大小刚好是schema中定义的大小
| RC BplusTreeScanner::next_entry | ( | RID & | rid | ) |
如果这里直接去加锁,那可能会造成死锁 因为这里访问页面的方式顺序与插入、删除的顺序不一样 如果加锁失败,就由上层做重试
| RC BplusTreeScanner::open | ( | const char * | left_user_key, |
| int | left_len, | ||
| bool | left_inclusive, | ||
| const char * | right_user_key, | ||
| int | right_len, | ||
| bool | right_inclusive | ||
| ) |
扫描指定范围的数据
| left_user_key | 扫描范围的左边界,如果是null,则没有左边界 |
| left_len | left_user_key 的内存大小(只有在变长字段中才会关注) |
| left_inclusive | 左边界的值是否包含在内 |
| right_user_key | 扫描范围的右边界。如果是null,则没有右边界 |
| right_len | right_user_key 的内存大小(只有在变长字段中才会关注) |
| right_inclusive | 右边界的值是否包含在内 |