Unverified Commit e04ed520 authored by groot's avatar groot Committed by GitHub
Browse files

Merge pull request #2458 from yhmo/v91

merge before index
parents 9e68e4e6 1779f1d9
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1408,7 +1408,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