You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/26 01:03:45 UTC
[doris] branch branch-1.1-lts updated: [improvement](publish) add publish version cost (#13651)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
new 279aafd1e0 [improvement](publish) add publish version cost (#13651)
279aafd1e0 is described below
commit 279aafd1e082d11ea48217c4cd721e151727027d
Author: yixiutt <10...@users.noreply.github.com>
AuthorDate: Wed Oct 26 09:03:38 2022 +0800
[improvement](publish) add publish version cost (#13651)
Co-authored-by: yixiutt <yi...@selectdb.com>
---
be/src/olap/storage_engine.cpp | 49 +-----------------------
be/src/olap/task/engine_publish_version_task.cpp | 3 +-
be/src/olap/task/engine_task.h | 4 --
3 files changed, 3 insertions(+), 53 deletions(-)
diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index 5d01e6560b..135da0accb 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -1028,58 +1028,11 @@ void StorageEngine::notify_listeners() {
}
OLAPStatus StorageEngine::execute_task(EngineTask* task) {
- {
- 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<UniqueWriteLock> wrlocks;
- for (TabletInfo& tablet_info : tablet_infos) {
- TabletSharedPtr tablet =
- _tablet_manager->get_tablet(tablet_info.tablet_id, tablet_info.schema_hash);
- if (tablet != nullptr) {
- related_tablets.push_back(tablet);
- wrlocks.push_back(UniqueWriteLock(tablet->get_header_lock()));
- } else {
- LOG(WARNING) << "could not get tablet before prepare tabletid: "
- << tablet_info.tablet_id;
- }
- }
- // add write lock to all related tablets
- OLAPStatus prepare_status = task->prepare();
- if (prepare_status != OLAP_SUCCESS) {
- return prepare_status;
- }
- }
-
- // do execute work without lock
OLAPStatus exec_status = task->execute();
if (exec_status != OLAP_SUCCESS) {
return exec_status;
}
-
- {
- std::vector<TabletInfo> tablet_infos;
- // related tablets may be changed after execute task, so that get them here again
- task->get_related_tablets(&tablet_infos);
- sort(tablet_infos.begin(), tablet_infos.end());
- std::vector<TabletSharedPtr> related_tablets;
- std::vector<UniqueWriteLock> wrlocks;
- for (TabletInfo& tablet_info : tablet_infos) {
- TabletSharedPtr tablet =
- _tablet_manager->get_tablet(tablet_info.tablet_id, tablet_info.schema_hash);
- if (tablet != nullptr) {
- related_tablets.push_back(tablet);
- wrlocks.push_back(UniqueWriteLock(tablet->get_header_lock()));
- } else {
- LOG(WARNING) << "could not get tablet before finish tabletid: "
- << tablet_info.tablet_id;
- }
- }
- // add write lock to all related tablets
- OLAPStatus fin_status = task->finish();
- return fin_status;
- }
+ 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 14a3bd3ce0..1abace542a 100644
--- a/be/src/olap/task/engine_publish_version_task.cpp
+++ b/be/src/olap/task/engine_publish_version_task.cpp
@@ -37,6 +37,7 @@ EnginePublishVersionTask::EnginePublishVersionTask(TPublishVersionRequest& publi
OLAPStatus EnginePublishVersionTask::finish() {
OLAPStatus res = OLAP_SUCCESS;
int64_t transaction_id = _publish_version_req.transaction_id;
+ OlapStopWatch watch;
VLOG_NOTICE << "begin to process publish version. transaction_id=" << transaction_id;
// each partition
@@ -154,7 +155,7 @@ OLAPStatus 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();
return res;
}
diff --git a/be/src/olap/task/engine_task.h b/be/src/olap/task/engine_task.h
index cbfd914ad1..e7eaf41950 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 OLAPStatus prepare() { return OLAP_SUCCESS; }
virtual OLAPStatus execute() { return OLAP_SUCCESS; }
virtual OLAPStatus finish() { return OLAP_SUCCESS; }
- virtual OLAPStatus cancel() { return OLAP_SUCCESS; }
- virtual void get_related_tablets(std::vector<TabletInfo>* tablet_infos) {}
};
} // end namespace doris
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org