Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

持久化功能 #376

Merged
merged 88 commits into from
Apr 28, 2024
Merged

持久化功能 #376

merged 88 commits into from
Apr 28, 2024

Conversation

hnwyllmm
Copy link
Collaborator

What problem were solved in this pull request?

Issue Number: close #118 #279

Problem:
当前的WAL仅记录了事务的日志,没有记录内部对象,比如record manager、B+树等的日志,导致在异常重启时,可能正常无法恢复。

What is changed and how it works?

除了记录事务日志,还记录了Buffer pool、record manager、B+树等内部数据日志,可以保证内部对象变更后断电等异常,仍然可以通过日志来恢复数据。

另外,此PR也实现了事务的回滚日志。

### What problem were solved in this pull request?

Problem:
实现 buffer pool 支持WAL

### What is changed and how it works?
buffer pool中分配和释放页面时,记录日志,并支持日志恢复。
当前buffer pool不会从文件中删除某个页面,释放是指标记为未删除。

- 在分配释放页面记录日志时,并没有等待日志完成;
- 将页面数据刷新到磁盘中时,会等待对应的日志刷新到磁盘

### Other information
1. 日志接口LogHandler转换为纯接口,并实现DiskLogHandler表示记录磁盘的日志处理器,与VacuousLogHandler,表示一个什么都不做的日志处理器,用于测试;
2. 一个LogHandler属于一个Db,Db中使用 DiskLogHandler;
3. 在创建表、索引时,需要想办法传递 LogHandler;
4. BufferPoolManager 仍为全局对象,不是Db专属的。
What problem were solved in this pull request?
Problem:
RecordManager 支持WAL

What is changed and how it works?
每次做增删改时,都记录日志。

Other information
实现了整合buffer pool log replayer的IntegratedLogReplayer
RecordScanner 不在将原始指针直接返回给调用者
为了支持(判断+更新)的原子记录更新操作,重新实现了visit_record
当前忽略了记录日志失败的情况
实际上,记录日志失败,不再应该继续执行操作
代码中使用readonly的地方,改成了 ReadWriteMode 枚举值
log entry 把unique_ptr改成vector
去掉init_header_page日志;
### What problem were solved in this pull request?

Problem:
bplus tree 当前不支持WAL。

### What is changed and how it works?
增加B+树的WAL
### What problem were solved in this pull request?


Problem:

文档已经陈旧,需要更新

### What is changed and how it works?
更新readme文档,增加architecture文档,miniob-introduction文档改为简单的介绍文档。
### What problem were solved in this pull request?

Problem:
合并double write buffer代码后,一些单元测试无法测试通过

主要修复了Bplus tree log测试:当一个frame涉及多个动作时,只重做了第一个动作(这个与dwb无关);
bplus tree 重做没有unpin frame;
double write buffer 导致数据没有完全写入磁盘,而写入到了共享dwb文件中。
clang-format
### What problem were solved in this pull request?

Problem:
增加调试日志

### What is changed and how it works?

### Other information
@hnwyllmm hnwyllmm merged commit 8c026d3 into oceanbase:main Apr 28, 2024
12 checks passed
@hnwyllmm hnwyllmm deleted the durability branch April 28, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

load数据之后,没有刷盘,造成重启以后读不到数据
1 participant