This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new a5db1be44f [enhancement](publish) add metic publish version cost (#13522) a5db1be44f is described below commit a5db1be44f464b80b892307a4ddd454d29fc0d8d Author: yixiutt <102007456+yixi...@users.noreply.github.com> AuthorDate: Fri Oct 21 19:17:03 2022 +0800 [enhancement](publish) add metic publish version cost (#13522) Co-authored-by: yixiutt <yi...@selectdb.com> --- be/src/olap/storage_engine.cpp | 32 +----------------------- be/src/olap/task/engine_publish_version_task.cpp | 3 ++- be/src/olap/task/engine_task.h | 4 --- 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp index 4e594c8a62..183e4fa5ba 100644 --- a/be/src/olap/storage_engine.cpp +++ b/be/src/olap/storage_engine.cpp @@ -1026,38 +1026,8 @@ void StorageEngine::notify_listeners() { } Status StorageEngine::execute_task(EngineTask* task) { - auto lock_related_tablets = [&]() -> std::vector<std::unique_lock<std::shared_mutex>> { - // add write lock to all related tablets - std::vector<TabletInfo> tablet_infos; - task->get_related_tablets(&tablet_infos); - sort(tablet_infos.begin(), tablet_infos.end()); - std::vector<TabletSharedPtr> related_tablets; - std::vector<std::unique_lock<std::shared_mutex>> wrlocks; - for (TabletInfo& tablet_info : tablet_infos) { - TabletSharedPtr tablet = _tablet_manager->get_tablet(tablet_info.tablet_id); - if (tablet != nullptr) { - related_tablets.push_back(tablet); - wrlocks.push_back(std::unique_lock<std::shared_mutex>(tablet->get_header_lock())); - } else { - LOG(WARNING) << "could not get tablet before prepare tabletid: " - << tablet_info.tablet_id; - } - } - return wrlocks; - }; - - { - auto wrlocks = lock_related_tablets(); - RETURN_IF_ERROR(task->prepare()); - } - - // do execute work without lock RETURN_IF_ERROR(task->execute()); - - { - auto wrlocks = lock_related_tablets(); - return task->finish(); - } + return task->finish(); } // check whether any unused rowsets's id equal to rowset_id diff --git a/be/src/olap/task/engine_publish_version_task.cpp b/be/src/olap/task/engine_publish_version_task.cpp index c44a5f665e..25b55955c6 100644 --- a/be/src/olap/task/engine_publish_version_task.cpp +++ b/be/src/olap/task/engine_publish_version_task.cpp @@ -59,6 +59,7 @@ void EnginePublishVersionTask::notify() { Status EnginePublishVersionTask::finish() { Status res = Status::OK(); int64_t transaction_id = _publish_version_req.transaction_id; + OlapStopWatch watch; VLOG_NOTICE << "begin to process publish version. transaction_id=" << transaction_id; // each partition @@ -181,7 +182,7 @@ Status EnginePublishVersionTask::finish() { } LOG(INFO) << "finish to publish version on transaction." - << "transaction_id=" << transaction_id + << "transaction_id=" << transaction_id << ", cost(us): " << watch.get_elapse_time_us() << ", error_tablet_size=" << _error_tablet_ids->size() << ", res=" << res.to_string(); return res; } diff --git a/be/src/olap/task/engine_task.h b/be/src/olap/task/engine_task.h index 6e5e146f65..f9b533668f 100644 --- a/be/src/olap/task/engine_task.h +++ b/be/src/olap/task/engine_task.h @@ -31,12 +31,8 @@ namespace doris { // add "Engine" as task prefix to prevent duplicate name with agent task class EngineTask { public: - // use olap_status not agent_status, because the task is very close to engine - virtual Status prepare() { return Status::OK(); } virtual Status execute() { return Status::OK(); } virtual Status finish() { return Status::OK(); } - virtual Status cancel() { return Status::OK(); } - virtual void get_related_tablets(std::vector<TabletInfo>* tablet_infos) {} }; } // end namespace doris --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org