diff --git a/cpp/src/db/DBImpl.cpp b/cpp/src/db/DBImpl.cpp index e2bad26deb..747a61ddbe 100644 --- a/cpp/src/db/DBImpl.cpp +++ b/cpp/src/db/DBImpl.cpp @@ -898,36 +898,34 @@ DBImpl::BackgroundBuildIndex() { meta_ptr_->FilesToIndex(to_index_files); Status status; +// scheduler::BuildIndexJobPtr +// job = std::make_shared(0, meta_ptr_, options_); + // step 2: put build index task to scheduler +// for (auto &file : to_index_files) { +// scheduler::TableFileSchemaPtr file_ptr = std::make_shared(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 failed: " << status.ToString(); +// } + for (auto &file : to_index_files) { - scheduler::BuildIndexJobPtr - job = std::make_shared(0, meta_ptr_, options_); - - scheduler::TableFileSchemaPtr file_ptr = std::make_shared(file); - - job->AddToIndexFiles(file_ptr); - scheduler::JobMgrInst::GetInstance()->Put(job); - job->WaitBuildIndexFinish(); - if (!job->GetStatus().ok()) { - Status status = job->GetStatus(); + 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; + } } - -// 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"; } diff --git a/cpp/src/metrics/PrometheusMetrics.cpp b/cpp/src/metrics/PrometheusMetrics.cpp index bc1860389f..182f14d46c 100644 --- a/cpp/src/metrics/PrometheusMetrics.cpp +++ b/cpp/src/metrics/PrometheusMetrics.cpp @@ -46,7 +46,7 @@ PrometheusMetrics::Init() { return s.code(); } - const std::string uri = std::string("/tmp/metrics"); + const std::string uri = std::string("/metrics"); const std::size_t num_threads = 2; // Init Exposer