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

cold_backup: some bug fix to support hdfs-fuse as storage media #150

Merged
merged 4 commits into from
Aug 10, 2018

Conversation

shengofsun
Copy link
Contributor

  1. modify the cold backup path from checkpoint@a.b.c.d:port to chkpt_a.b.c.d_port, as old format not valid in hdfs
  2. implement meta_data's query interface for local block service. in order to support meta-data querying, a small metadata file is added for each real file.

qinzuoyan
qinzuoyan previously approved these changes Aug 9, 2018
qinzuoyan
qinzuoyan previously approved these changes Aug 9, 2018
// delete the meta data file.
// skip to check the result for simplicity
std::string meta_file = utils::filesystem::path_combine(_root, get_metafile(req.file_name));
utils::filesystem::remove_path(meta_file);
Copy link
Contributor

Choose a reason for hiding this comment

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

这个 没处理 error_code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

后面还有个文件,所以就先尝试删下这个,再删下一个。出错了底层会有log

Copy link
Contributor

@neverchanje neverchanje Aug 9, 2018

Choose a reason for hiding this comment

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

建议不能假设一次删失败了下次就一定删失败,如果都这样那都看 syslog 好了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个地方稍微改了一点。
不过看log也没啥,都在一个进程里。syslog要是也在一个进程里,一个文件下,都看syslog其实也没啥……

}
} else {
if (fin.is_open())
Copy link
Contributor

@neverchanje neverchanje Aug 9, 2018

Choose a reason for hiding this comment

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

可不可以把这俩的 close 一开始就用 defer 管理起来,看着很容易出 bug 的样子

auto cleanup = defer([&fin, &fout](){
   if(fin.isopen()) fin.close();
   if(fout.isopen()) fout.close();
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

因为句柄要在最后一句enqueue之前关闭,defer保证不了这一点。除非抽个函数出来,改动有点大了。

@qinzuoyan qinzuoyan merged commit e53c682 into XiaoMi:master Aug 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants