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

feat: Check point #226

Merged

Conversation

dingxiaoshuai123
Copy link
Collaborator

@dingxiaoshuai123 dingxiaoshuai123 commented Mar 22, 2024

暂时使用 中文 注释,方便 review 。
借用了 get 和 set 命令发起 同步和异步 checkpoint 。调用 PSTORE 的接口,可传入 DB index 和 checkpointPath 指定 DB 在指定的路径下生成 checkpoint 。
比如在 ./dump 目录下生成所有 DB 的 checkpoint 。
以 2 个 DB ,每一个 DB 下有 2 个 Rocksdb 为例, 生成的 dump 目录结构如下 :
image

可以在 on_snapshot_save 函数下,调用 PSTORE 的接口生成 Checkpoint 。
TODO :
1、提供 Load Checkpoint 的接口, 从指定的路径打开一个新的 DB,完成快照的安装。

review 时任何问题请 comment 或者 微信。

@github-actions github-actions bot added Invalid PR Title ✏️ Feature New feature or request labels Mar 22, 2024
@dingxiaoshuai123 dingxiaoshuai123 marked this pull request as draft March 22, 2024 03:50
@@ -0,0 +1,69 @@
//
// Created by dingxiaoshuai on 2024/3/20.
Copy link
Collaborator Author

@dingxiaoshuai123 dingxiaoshuai123 Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是个草稿,初步 review 了之后改这个

tests/admin_test.go Outdated Show resolved Hide resolved
src/store.h Outdated Show resolved Hide resolved
src/store.cc Outdated Show resolved Hide resolved
@dingxiaoshuai123 dingxiaoshuai123 changed the title feature: Check point feat: Check point Mar 22, 2024
@hotjump
Copy link
Collaborator

hotjump commented Mar 22, 2024

需要把do_checkpoint包装在on_snapshot_save里,然后可以通过主动调用braft的do_snapshot去异步驱动状态机里的on_snapshot_save。另一个要实现的就是on_snapshot_load,这个可以用来Install snapshot,但是这里需要注意一个事情就是,在正常启动时也会调用这个函数,所以在程序刚启动时,可以先设一个flag表示自己是刚启动,然后把flag置反,直接跳出函数就地启动即可,不去install snapshot。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Do_checkpoint needs to be packaged in on_snapshot_save, and then on_snapshot_save in the state machine can be asynchronously driven by actively calling braft's do_snapshot. Another thing to implement is on_snapshot_load, which can be used to install snapshot, but one thing to note here is that this function will also be called during normal startup, so when the program just starts, you can first set a flag to indicate that it has just started. , then set the flag to the reverse position, and just jump out of the function and start it on the spot without installing the snapshot.

@dingxiaoshuai123 dingxiaoshuai123 deleted the CheckPoint branch March 22, 2024 07:49
@dingxiaoshuai123 dingxiaoshuai123 restored the CheckPoint branch March 22, 2024 07:49
@dingxiaoshuai123 dingxiaoshuai123 changed the base branch from unstable to import-braft March 25, 2024 03:31
@dingxiaoshuai123 dingxiaoshuai123 marked this pull request as ready for review March 25, 2024 03:38
@dingxiaoshuai123 dingxiaoshuai123 merged commit fbf365f into OpenAtomFoundation:import-braft Mar 25, 2024
2 checks passed
@dingxiaoshuai123 dingxiaoshuai123 deleted the CheckPoint branch March 25, 2024 04:50
@Mixficsol Mixficsol mentioned this pull request Apr 15, 2024
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants