-
Notifications
You must be signed in to change notification settings - Fork 58
cold_backup: some bug fix to support hdfs-fuse as storage media #150
Conversation
shengofsun
commented
Aug 8, 2018
- 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
- 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.
// 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); |
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.
这个 没处理 error_code
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.
后面还有个文件,所以就先尝试删下这个,再删下一个。出错了底层会有log
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.
建议不能假设一次删失败了下次就一定删失败,如果都这样那都看 syslog 好了
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.
这个地方稍微改了一点。
不过看log也没啥,都在一个进程里。syslog要是也在一个进程里,一个文件下,都看syslog其实也没啥……
} | ||
} else { | ||
if (fin.is_open()) |
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.
可不可以把这俩的 close 一开始就用 defer 管理起来,看着很容易出 bug 的样子
auto cleanup = defer([&fin, &fout](){
if(fin.isopen()) fin.close();
if(fout.isopen()) fout.close();
})
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.
因为句柄要在最后一句enqueue之前关闭,defer保证不了这一点。除非抽个函数出来,改动有点大了。