-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: Check point #226
Conversation
Co-authored-by: wuxianrong <wuxianrong@360.cn>
* finish zset cmd zcard
* feat: zset cmd zrevrangebyscore * format * format * format * fix
…Foundation#196) issue: OpenAtomFoundation#30 Signed-off-by: HappyUncle <code4happy@gmail.com>
* finish set cmd sdiff sdiffstore smembers --------- Co-authored-by: Xin.Zh <dragoncharlie@foxmail.com>
issue: OpenAtomFoundation#30 Signed-off-by: HappyUncle <code4happy@gmail.com>
* add class DB & mutex
src/checkpoint_manager.cpp
Outdated
@@ -0,0 +1,69 @@ | |||
// | |||
// Created by dingxiaoshuai on 2024/3/20. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是个草稿,初步 review 了之后改这个
4e195c5
to
c66c0f5
Compare
需要把do_checkpoint包装在on_snapshot_save里,然后可以通过主动调用braft的do_snapshot去异步驱动状态机里的on_snapshot_save。另一个要实现的就是on_snapshot_load,这个可以用来Install snapshot,但是这里需要注意一个事情就是,在正常启动时也会调用这个函数,所以在程序刚启动时,可以先设一个flag表示自己是刚启动,然后把flag置反,直接跳出函数就地启动即可,不去install snapshot。 |
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. |
* Add logo to Readme
issue: OpenAtomFoundation#30 Signed-off-by: HappyUncle <code4happy@gmail.com>
d8cb239
to
c483988
Compare
c483988
to
462abf6
Compare
fbf365f
into
OpenAtomFoundation:import-braft
暂时使用 中文 注释,方便 review 。
借用了 get 和 set 命令发起 同步和异步 checkpoint 。调用 PSTORE 的接口,可传入 DB index 和 checkpointPath 指定 DB 在指定的路径下生成 checkpoint 。
比如在 ./dump 目录下生成所有 DB 的 checkpoint 。
以 2 个 DB ,每一个 DB 下有 2 个 Rocksdb 为例, 生成的 dump 目录结构如下 :
可以在 on_snapshot_save 函数下,调用 PSTORE 的接口生成 Checkpoint 。
TODO :
1、提供 Load Checkpoint 的接口, 从指定的路径打开一个新的 DB,完成快照的安装。
review 时任何问题请 comment 或者 微信。