fix conflict

Former-commit-id: afdfa1f34302637762b06fa6ccb4058dbb391922
pull/191/head
Yu Kun 2019-10-08 17:26:25 +08:00
parent 0a77b4547f
commit 0af6d85ea9
4 changed files with 29 additions and 29 deletions

View File

@ -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) {
std::cout << "get to index file" << std::endl;
status = BuildIndex(file);
if (!status.ok()) {
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();
}
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";
}

View File

@ -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);
}

View File

@ -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_);

View File

@ -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;