-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[improvement](binlog) Gc BE binlog metas when tablet is dropped #22447
Conversation
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
(From new machine)TeamCity pipeline, clickbench performance test result: |
run P0 |
run buildall |
(From new machine)TeamCity pipeline, clickbench performance test result: |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
(From new machine)TeamCity pipeline, clickbench performance test result: |
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.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
std::pair<std::string, bool> last_info = std::make_pair("", false); | ||
auto traverse_binlog_meta_func = [&last_info, &collector](const std::string& key, | ||
const std::string& value) -> bool { | ||
auto& [last_prefix, need_collect] = last_info; |
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.
改成使用~,来递增,重新使用rocksdb seek减少过滤吧
比如key是binlog_meta_6943f1585fe834b5-e542c2b83a21d0b7_00000000000000000069_020000000000000135449d7cd7eadfe672aa0f928fa99593', extract last part '020000000000000135449d7cd7eadfe672aa0f928fa99593
, 之后改成binlog_meta_6943f1585fe834b5-e542c2b83a21d0b7~
, 用这个key去过滤rocksdb
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
(From new machine)TeamCity pipeline, clickbench performance test result: |
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.
LGTM
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.
LGTM
PR approved by at least one committer and no changes requested. |
Proposed changes
GC BE binlog metas when tablet is dropped.
Add a timed GC binlog metas task in the timed GC task of BE. When cleaning, it will traverse all keys starting with binlog_meta_ in the metadata, and get its corresponding rowset meta and check whether the tablet belonging to the rowset meta exists. If it does not exist (that is, it has been dropped), clean up all binlog_meta and binlog_data corresponding to this tablet.
In the implementation details, because the key of rocksdb is internally ordered, the same tablet will be traversed continuously, so if the tablet uuid obtained this time is the same as the last time, you can skip the check directly and execute the last operation (cleaned up or skipped).
At the same time, the deletion of binlog_meta and binlog_data corresponding to the same tablet-rowset must be in the same transaction, in order to ensure that metadata leakage does not occur.
Note
If there are existing binlog meta and tombstone in the cluster, they need to be GCed before upgrading to this version. This upgrade is not a smooth upgrade.