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: flush oldest cf #275

Merged

Conversation

dingxiaoshuai123
Copy link
Collaborator

@dingxiaoshuai123 dingxiaoshuai123 commented Apr 13, 2024

1, 使用 WriteBufferManager 控制一个 DB 内所有 RocksDB 的上限, 当超过上限之后, Flush 最老的 CF.
2, 定期检查队列长度, 当队列长度超过阈值, 手动 Flush 最旧 CF.
3, 根据 Flush 次数触发 do_snapshot 行为.

修改的地方:
1 在 flush listener 中同步 flush 会死锁, 具体的位置还没有找, 所以改为异步 flush.
2 更新 last_flush_index 的逻辑有问题, 导致一直是 0, 已更改.
3 记录 SequenceNumber 的逻辑有问题, 已更改.
4 对一个 flush 带来的连锁反应进行了模拟.

@github-actions github-actions bot added the ✏️ Feature New feature or request label Apr 13, 2024
@dingxiaoshuai123 dingxiaoshuai123 marked this pull request as draft April 13, 2024 15:40
@dingxiaoshuai123 dingxiaoshuai123 mentioned this pull request Apr 16, 2024
@dingxiaoshuai123 dingxiaoshuai123 force-pushed the flush_event branch 2 times, most recently from 452979a to b165273 Compare April 17, 2024 02:52
@dingxiaoshuai123 dingxiaoshuai123 marked this pull request as ready for review April 25, 2024 06:03
src/storage/include/storage/storage.h Show resolved Hide resolved
src/storage/src/redis.cc Outdated Show resolved Hide resolved
src/storage/src/storage.cc Outdated Show resolved Hide resolved
@dingxiaoshuai123 dingxiaoshuai123 force-pushed the flush_event branch 2 times, most recently from 1f56258 to c8017d9 Compare April 28, 2024 10:30
@@ -525,7 +525,7 @@ butil::Status PRaft::DoSnapshot(int64_t self_snapshot_index, bool is_sync) {
// TODO(panlei) Increase the self_log_index parameter
// TODO(panlei) Use the is_sync parameter to determine whether
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两个todo需要删吗?

Copy link
Collaborator

Choose a reason for hiding this comment

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

}

public:
static std::atomic_int64_t max_gap_;
Copy link
Contributor

Choose a reason for hiding this comment

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

没有初始值?

@AlexStocks AlexStocks merged commit 5ca3f7c into OpenAtomFoundation:import-braft Apr 29, 2024
5 checks passed
@dingxiaoshuai123 dingxiaoshuai123 deleted the flush_event branch April 29, 2024 11:45
dingxiaoshuai123 added a commit to dingxiaoshuai123/pikiwidb that referenced this pull request Apr 30, 2024
* Revert to using the version with independent atomic variables.
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.

4 participants