merge before index

Signed-off-by: groot <yihua.mo@zilliz.com>
pull/2536/head
groot 2020-05-28 22:35:02 +08:00 committed by JinHai-CN
parent 30d6f986bf
commit 08c919156c
1 changed files with 8 additions and 1 deletions

View File

@ -1639,7 +1639,14 @@ DBImpl::CreateIndex(const std::shared_ptr<server::Context>& context, const std::
// step 1: wait merge file thread finished to avoid duplicate data bug
auto status = Flush();
WaitMergeFileFinish(); // let merge file thread finish
std::set<std::string> merge_collection_ids;
// merge all files for this collection, including its partitions
std::set<std::string> merge_collection_ids = {collection_id};
std::vector<meta::CollectionSchema> partition_array;
status = meta_ptr_->ShowPartitions(collection_id, partition_array);
for (auto& schema : partition_array) {
merge_collection_ids.insert(schema.collection_id_);
}
StartMergeTask(merge_collection_ids, true); // start force-merge task
WaitMergeFileFinish(); // let force-merge file thread finish