fix(db): fix create directory bug in release

Former-commit-id: 511730da61c4afac4b09e38aafaf77ea9617b822
This commit is contained in:
Xu Peng 2019-05-16 11:20:10 +08:00
parent c7f4708fe7
commit 4380016d4a

View File

@ -86,7 +86,11 @@ DBMetaImpl::DBMetaImpl(const DBMetaOptions& options_)
Status DBMetaImpl::initialize() {
if (!boost::filesystem::is_directory(_options.path)) {
assert(boost::filesystem::create_directory(_options.path));
auto ret = boost::filesystem::create_directory(_options.path);
if (!ret) {
LOG(ERROR) << "Create directory " << _options.path << " Error";
}
assert(ret);
}
ConnectorPtr = std::make_unique<ConnectorT>(StoragePrototype(_options.path+"/meta.sqlite"));
@ -123,7 +127,11 @@ Status DBMetaImpl::add_group(GroupSchema& group_info) {
auto group_path = GetGroupPath(group_info.group_id);
if (!boost::filesystem::is_directory(group_path)) {
assert(boost::filesystem::create_directory(group_path));
auto ret = boost::filesystem::create_directory(group_path);
if (!ret) {
LOG(ERROR) << "Create directory " << group_path << " Error";
}
assert(ret);
}
return Status::OK();
@ -207,7 +215,11 @@ Status DBMetaImpl::add_group_file(GroupFileSchema& group_file) {
auto partition_path = GetGroupDatePartitionPath(group_file.group_id, group_file.date);
if (!boost::filesystem::is_directory(partition_path)) {
assert(boost::filesystem::create_directory(partition_path));
auto ret = boost::filesystem::create_directory(partition_path);
if (!ret) {
LOG(ERROR) << "Create directory " << partition_path << " Error";
}
assert(ret);
}
return Status::OK();