Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

replica-server: remove checkpoint dirs when cold backup completed #216

Merged
merged 16 commits into from
Jan 14, 2019

Conversation

qinzuoyan
Copy link
Member

to release storage resouces as soon as possiable.

@qinzuoyan qinzuoyan added the type/enhancement Indicates new feature requests label Jan 12, 2019
@qinzuoyan qinzuoyan self-assigned this Jan 12, 2019
@qinzuoyan
Copy link
Member Author

现在冷备份完成后,backup所使用的checkpoint文件夹会一直保留着,占据不必要的存储空间,几乎让存储用量增大一倍。
这个提交的目的是:在backup完成后,及时清理无用的checkpoint文件夹,释放存储资源。

", old_backup_status = %s",
new_context->name,
backup_context->request.backup_id,
cold_backup_status_to_string(backup_status));
backup_context->cancel();
_cold_backup_contexts.erase(policy_name);
on_cold_backup(request, response);
if (backup_id != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

现在的backup_id是开始备份的时间戳吧?所以肯定不是0?

Copy link
Member Author

Choose a reason for hiding this comment

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

是的,是时间戳

hycdong
hycdong previously approved these changes Jan 14, 2019
if (status() == partition_status::type::PS_PRIMARY ||
status() == partition_status::type::PS_SECONDARY) {
cold_backup_context_ptr backup_context = nullptr;
auto find = _cold_backup_contexts.find(policy_name);
if (find != _cold_backup_contexts.end()) {
backup_context = find->second;
} else {
if (backup_id == 0) {
if (status() == partition_status::type::PS_PRIMARY) {
Copy link
Contributor

@neverchanje neverchanje Jan 14, 2019

Choose a reason for hiding this comment

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

感觉这个 check 应该放在 send_backup_request_to_secondary 里面,这样就不用每次调用都写一遍

Copy link
Member Author

Choose a reason for hiding this comment

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

也就多写一遍,而且外面确实就需要检查一下,调用这个函数的角色就应当是primary

}

for (std::string &d : sub_dirs) {
std::string dirname = ::dsn::utils::filesystem::get_file_name(d);
Copy link
Contributor

Choose a reason for hiding this comment

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

去掉 ::dsn

Copy link
Member Author

Choose a reason for hiding this comment

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

done

hycdong
hycdong previously approved these changes Jan 14, 2019
neverchanje
neverchanje previously approved these changes Jan 14, 2019
@qinzuoyan qinzuoyan dismissed stale reviews from neverchanje and hycdong via 65be386 January 14, 2019 07:33
@@ -181,7 +181,7 @@ client:begin_write:id=169,key=k169,value=v169,timeout=0
inject:on_aio_call:node=r2,task_code=LPC_WRITE_REPLICATION_LOG_SHARED
config:{4,r1,[r3]}

state:{{r1,pri,4,24},{r3,sec,4,21}}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个 case 改动是啥原因?

Copy link
Member Author

@qinzuoyan qinzuoyan Jan 14, 2019

Choose a reason for hiding this comment

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

因为代码发生变化,造成这里的表现和原来不一致了,导致travis上测试失败。act测试现在就是有这个问题,有些不确定性,后面需要改进一下。

@qinzuoyan qinzuoyan merged commit 3a2a054 into master Jan 14, 2019
@qinzuoyan qinzuoyan deleted the qinzuoyan branch January 14, 2019 09:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants