提交 7b56cdbf 编写于 作者: Q qinzuoyan 提交者: WeijieSun

fix gc_checkpoints bug, which may cause deleted checkpoint put back to checkpoint list

Summary: Ref T10570

Test Plan: N/A

Reviewers: sunweijie, cailiuyang

Reviewed By: sunweijie

Subscribers: #pegasus

Maniphest Tasks: T10570

Differential Revision: https://phabricator.d.xiaomi.net/D82629
上级 3cde8d4b
......@@ -342,7 +342,7 @@ void pegasus_server_impl::gc_checkpoints()
to_delete_list.push_back(del_d);
delete_max_index = i;
}
if (delete_max_index > 0) {
if (delete_max_index >= 0) {
_checkpoints.erase(_checkpoints.begin(), _checkpoints.begin() + delete_max_index + 1);
}
......@@ -380,8 +380,9 @@ void pegasus_server_impl::gc_checkpoints()
}
}
// put back checkpoints which is not deleted
// ATTENTION: the put back checkpoint may be incomplete, which will cause failure on load.
// put back checkpoints which is not deleted, to make it delete again in the next gc time.
// ATTENTION: the put back checkpoint may be incomplete, which will cause failure on load. But
// it would not cause data lost, because incomplete checkpoint can not be loaded successfully.
if (!put_back_list.empty()) {
::dsn::utils::auto_lock<::dsn::utils::ex_lock_nr> l(_checkpoints_lock);
if (_checkpoints.empty() || put_back_list.back() < _checkpoints.front()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册