!20492 fix: code review check

Merge pull request !20492 from guozhijian/fix_code_review_check
This commit is contained in:
i-robot 2021-07-20 12:27:55 +00:00 committed by Gitee
commit 36820f38dc
2 changed files with 5 additions and 0 deletions

View File

@ -540,6 +540,7 @@ MSRStatus ShardIndexGenerator::ExecuteTransaction(const int &shard_no, std::pair
in.open(realpath.value(), std::ios::in | std::ios::binary);
if (!in.good()) {
MS_LOG(ERROR) << "Invalid file, failed to open file: " << shard_address;
in.close();
return FAILED;
}
(void)sqlite3_exec(db.second, "BEGIN TRANSACTION;", nullptr, nullptr, nullptr);

View File

@ -423,6 +423,8 @@ MSRStatus ShardReader::ReadAllRowsInShard(int shard_id, const std::string &sql,
auto realpath = Common::GetRealPath(file_name);
if (!realpath.has_value()) {
MS_LOG(ERROR) << "Get real path failed, path=" << file_name;
sqlite3_free(errmsg);
sqlite3_close(db);
return FAILED;
}
@ -431,6 +433,8 @@ MSRStatus ShardReader::ReadAllRowsInShard(int shard_id, const std::string &sql,
fs->open(realpath.value(), std::ios::in | std::ios::binary);
if (!fs->good()) {
MS_LOG(ERROR) << "Invalid file, failed to open file: " << file_name;
sqlite3_free(errmsg);
sqlite3_close(db);
return FAILED;
}
}