提交 10a37ca5 编写于 作者: P peng.xu

Merge branch 'branch-0.3.1' into 'branch-0.3.1'

MS-236: Add MySQLMetaImpl::HasNonIndexFiles fix

See merge request megasearch/milvus!225

Former-commit-id: 19344d286062eec3132cf0734071ecfc9aedd3ae
...@@ -400,12 +400,12 @@ Status MySQLMetaImpl::HasNonIndexFiles(const std::string &table_id, bool &has) { ...@@ -400,12 +400,12 @@ Status MySQLMetaImpl::HasNonIndexFiles(const std::string &table_id, bool &has) {
Query hasNonIndexFilesQuery = connectionPtr->query(); Query hasNonIndexFilesQuery = connectionPtr->query();
//since table_id is a unique column we just need to check whether it exists or not //since table_id is a unique column we just need to check whether it exists or not
hasNonIndexFilesQuery << "SELECT EXISTS " << hasNonIndexFilesQuery << "SELECT EXISTS " <<
"(SELECT 1 FROM TableFiles " << "(SELECT 1 FROM TableFiles " <<
"WHERE table_id = " << quote << table_id << " AND " << "WHERE table_id = " << quote << table_id << " AND " <<
"(file_type = " << std::to_string(TableFileSchema::RAW) << " OR " << "(file_type = " << std::to_string(TableFileSchema::RAW) << " OR " <<
"file_type = " << std::to_string(TableFileSchema::NEW) << " OR " << "file_type = " << std::to_string(TableFileSchema::NEW) << " OR " <<
"file_type = " << std::to_string(TableFileSchema::TO_INDEX) << ")) " << "file_type = " << std::to_string(TableFileSchema::TO_INDEX) << ")) " <<
"AS " << quote << "check" << ";"; "AS " << quote << "check" << ";";
ENGINE_LOG_DEBUG << "MySQLMetaImpl::HasNonIndexFiles: " << hasNonIndexFilesQuery.str(); ENGINE_LOG_DEBUG << "MySQLMetaImpl::HasNonIndexFiles: " << hasNonIndexFilesQuery.str();
...@@ -1420,12 +1420,18 @@ Status MySQLMetaImpl::UpdateTableFilesToIndex(const std::string &table_id) { ...@@ -1420,12 +1420,18 @@ Status MySQLMetaImpl::UpdateTableFilesToIndex(const std::string &table_id) {
Query updateTableFilesToIndexQuery = connectionPtr->query(); Query updateTableFilesToIndexQuery = connectionPtr->query();
updateTableFilesToIndexQuery << "UPDATE TableFiles " << updateTableFilesToIndexQuery << "UPDATE TableFiles " <<
"SET file_type = " << std::to_string(TableFileSchema::TO_INDEX) << " " << "SET file_type = " << std::to_string(TableFileSchema::TO_INDEX) << " " <<
"WHERE table_id = " << quote << table_id << " AND " << "WHERE table_id = " << quote << table_id << " AND " <<
"file_type = " << std::to_string(TableFileSchema::RAW) << ";"; "file_type = " << std::to_string(TableFileSchema::RAW) << ";";
ENGINE_LOG_DEBUG << "MySQLMetaImpl::UpdateTableFilesToIndex: " << updateTableFilesToIndexQuery.str(); ENGINE_LOG_DEBUG << "MySQLMetaImpl::UpdateTableFilesToIndex: " << updateTableFilesToIndexQuery.str();
if (!updateTableFilesToIndexQuery.exec()) {
ENGINE_LOG_ERROR << "QUERY ERROR WHEN UPDATING TABLE FILE";
return Status::DBTransactionError("QUERY ERROR WHEN UPDATING TABLE FILE",
updateTableFilesToIndexQuery.error());
}
} catch (const BadQuery &er) { } catch (const BadQuery &er) {
// Handle any query errors // Handle any query errors
ENGINE_LOG_ERROR << "QUERY ERROR WHEN UPDATING TABLE FILES TO INDEX" << ": " << er.what(); ENGINE_LOG_ERROR << "QUERY ERROR WHEN UPDATING TABLE FILES TO INDEX" << ": " << er.what();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册