Commit c6beac2d authored by 余昆's avatar 余昆
Browse files

fix conflict


Former-commit-id: ffc807d969b26da1638ea4a44056a0411b09af72
parent 549fb512
Loading
Loading
Loading
Loading
+23 −23
Original line number Diff line number Diff line
@@ -899,35 +899,35 @@ DBImpl::BackgroundBuildIndex() {
    Status status;

    // step 2: put build index task to scheduler
//    for (auto &file : to_index_files) {
//        scheduler::BuildIndexJobPtr
//            job = std::make_shared<scheduler::BuildIndexJob>(0, meta_ptr_, options_);
//
//        scheduler::TableFileSchemaPtr file_ptr = std::make_shared<meta::TableFileSchema>(file);
//
//        job->AddToIndexFiles(file_ptr);
//        scheduler::JobMgrInst::GetInstance()->Put(job);
//        job->WaitBuildIndexFinish();
//        if (!job->GetStatus().ok()) {
//            Status status = job->GetStatus();
//            ENGINE_LOG_ERROR << "Building index for " << file.id_ << " failed: " << status.ToString();
//        }
//    }
    for (auto &file : to_index_files) {
        scheduler::BuildIndexJobPtr
            job = std::make_shared<scheduler::BuildIndexJob>(0, meta_ptr_, options_);

        scheduler::TableFileSchemaPtr file_ptr = std::make_shared<meta::TableFileSchema>(file);

    for (auto &file : to_index_files) {
        std::cout << "get to index file" << std::endl;
        status = BuildIndex(file);
        if (!status.ok()) {
        job->AddToIndexFiles(file_ptr);
        scheduler::JobMgrInst::GetInstance()->Put(job);
        job->WaitBuildIndexFinish();
        if (!job->GetStatus().ok()) {
            Status status = job->GetStatus();
            ENGINE_LOG_ERROR << "Building index for " << file.id_ << " failed: " << status.ToString();
        }

        if (shutting_down_.load(std::memory_order_acquire)) {
            ENGINE_LOG_DEBUG << "Server will shutdown, skip build index action";
            break;
        }
    }


//    for (auto &file : to_index_files) {
//        std::cout << "get to index file" << std::endl;
//        status = BuildIndex(file);
//        if (!status.ok()) {
//            ENGINE_LOG_ERROR << "Building index for " << file.id_ << " failed: " << status.ToString();
//        }
//
//        if (shutting_down_.load(std::memory_order_acquire)) {
//            ENGINE_LOG_DEBUG << "Server will shutdown, skip build index action";
//            break;
//        }
//    }

    ENGINE_LOG_TRACE << "Background build index thread exit";
}

+2 −2
Original line number Diff line number Diff line
@@ -75,8 +75,8 @@ TaskCreator::Create(const BuildIndexJobPtr &job) {
    ResourcePtr res_ptr = ResMgrInst::GetInstance()->GetResource("disk");

    for (auto &to_index_file : job->to_index_files()) {
        auto task = std::make_shared<XBuildIndexTask>(to_index_file.second);
        task->label() = std::make_shared<SpecResLabel>(std::weak_ptr<Resource>(res_ptr));
        auto label = std::make_shared<SpecResLabel>(std::weak_ptr<Resource>(res_ptr));
        auto task = std::make_shared<XBuildIndexTask>(to_index_file.second, label);
        task->job_ = job;
        tasks.emplace_back(task);
    }
+2 −2
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@
namespace milvus {
namespace scheduler {

XBuildIndexTask::XBuildIndexTask(TableFileSchemaPtr file)
    : Task(TaskType::BuildIndexTask), file_(file) {
XBuildIndexTask::XBuildIndexTask(TableFileSchemaPtr file, TaskLabelPtr label)
    : Task(TaskType::BuildIndexTask, std::move(label)), file_(file) {
    if (file_) {
        to_index_engine_ = EngineFactory::Build(file_->dimension_, file_->location_, (EngineType) file_->engine_type_,
                                                (MetricType) file_->metric_type_, file_->nlist_);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ namespace scheduler {

class XBuildIndexTask : public Task {
 public:
    explicit XBuildIndexTask(TableFileSchemaPtr file);
    explicit XBuildIndexTask(TableFileSchemaPtr file, TaskLabelPtr label);

    void
    Load(LoadType type, uint8_t device_id) override;