提交 d5f7526c 编写于 作者: G groot 提交者: JinHai-CN

#2338 (#2345)

* fix #2264
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* typo
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* fix ut
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* typo
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* Remove unnecessary memcpy
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* remove SearchByID from C++SDK
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>

* #2338
Signed-off-by: Nyhmo <yihua.mo@zilliz.com>
上级 7f872486
...@@ -1731,7 +1731,7 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files ...@@ -1731,7 +1731,7 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files
} // Scoped Connection } // Scoped Connection
Status ret; Status ret;
int64_t files_count = 0; SegmentsSchema files;
for (auto& resRow : res) { for (auto& resRow : res) {
SegmentSchema collection_file; SegmentSchema collection_file;
collection_file.file_size_ = resRow["file_size"]; collection_file.file_size_ = resRow["file_size"];
...@@ -1759,12 +1759,15 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files ...@@ -1759,12 +1759,15 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files
continue; continue;
} }
files_holder.MarkFile(collection_file); files.emplace_back(collection_file);
files_count++;
} }
if (files_count > 0) { // no need to merge if files count less than 2
LOG_ENGINE_DEBUG_ << "Collect " << files_count << " to-merge files in collection " << collection_id; if (files.size() > 1) {
LOG_ENGINE_DEBUG_ << "Collect " << files.size() << " to-merge files in collection " << collection_id;
for (auto& file : files) {
files_holder.MarkFile(file);
}
} }
return ret; return ret;
} catch (std::exception& e) { } catch (std::exception& e) {
......
...@@ -1148,7 +1148,7 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file ...@@ -1148,7 +1148,7 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file
} }
Status result; Status result;
int64_t files_count = 0; SegmentsSchema files;
for (auto& file : selected) { for (auto& file : selected) {
SegmentSchema collection_file; SegmentSchema collection_file;
collection_file.file_size_ = std::get<5>(file); collection_file.file_size_ = std::get<5>(file);
...@@ -1174,12 +1174,15 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file ...@@ -1174,12 +1174,15 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file
result = status; result = status;
} }
files_holder.MarkFile(collection_file); files.emplace_back(collection_file);
files_count++;
} }
if (files_count > 0) { // no need to merge if files count less than 2
LOG_ENGINE_DEBUG_ << "Collect " << files_count << " to-merge files in collection " << collection_id; if (files.size() > 1) {
LOG_ENGINE_DEBUG_ << "Collect " << files.size() << " to-merge files in collection " << collection_id;
for (auto& file : files) {
files_holder.MarkFile(file);
}
} }
return result; return result;
} catch (std::exception& e) { } catch (std::exception& e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册