From 746591ca25e7a4c3b4f3a8df9ed3fb5e2d224f58 Mon Sep 17 00:00:00 2001 From: wxhwang Date: Fri, 8 Nov 2024 08:17:21 +0000 Subject: [PATCH] optimize restore event --- .../ob_tablet_group_restore.cpp | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/storage/high_availability/ob_tablet_group_restore.cpp b/src/storage/high_availability/ob_tablet_group_restore.cpp index 3b34270d6..d8b913525 100644 --- a/src/storage/high_availability/ob_tablet_group_restore.cpp +++ b/src/storage/high_availability/ob_tablet_group_restore.cpp @@ -1139,7 +1139,8 @@ int ObInitialTabletGroupRestoreTask::record_server_event_() "tenant_id", ctx_->arg_.tenant_id_, "ls_id", ctx_->arg_.ls_id_.id(), "is_leader", ctx_->arg_.is_leader_, - "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0)); + "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0), + "task_id", ctx_->task_id_); } return ret; } @@ -1496,7 +1497,8 @@ int ObStartTabletGroupRestoreTask::record_server_event_() "tenant_id", ctx_->arg_.tenant_id_, "ls_id", ctx_->arg_.ls_id_.id(), "is_leader", ctx_->arg_.is_leader_, - "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0)); + "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0), + "task_id", ctx_->task_id_); } return ret; } @@ -1725,7 +1727,8 @@ int ObFinishTabletGroupRestoreTask::record_server_event_() "tenant_id", ctx_->arg_.tenant_id_, "ls_id", ctx_->arg_.ls_id_.id(), "is_leader", ctx_->arg_.is_leader_, - "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0)); + "first_tablet_id", ctx_->arg_.tablet_id_array_.at(0), + "task_id", ctx_->task_id_); } return ret; } @@ -2888,16 +2891,22 @@ int ObTabletRestoreTask::check_need_copy_macro_blocks_( int ObTabletRestoreTask::record_server_event_() { int ret = OB_SUCCESS; + ObTabletGroupRestoreCtx *tablet_group_ctx = nullptr; if (OB_ISNULL(tablet_restore_ctx_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("ctx should not be null", K(ret)); + } else if (OB_ISNULL(ha_dag_net_ctx_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("dag net ctx should not be null", K(ret)); + } else if (FALSE_IT(tablet_group_ctx = static_cast(ha_dag_net_ctx_))) { } else { SERVER_EVENT_ADD("storage_ha", "tablet_restore_task", "tenant_id", tablet_restore_ctx_->tenant_id_, "ls_id", tablet_restore_ctx_->ls_id_.id(), "tablet_id", tablet_restore_ctx_->tablet_id_.id(), "action", ObTabletRestoreAction::get_action_str(tablet_restore_ctx_->action_), - "is_leader", tablet_restore_ctx_->is_leader_); + "is_leader", tablet_restore_ctx_->is_leader_, + "task_id", tablet_group_ctx->task_id_); } return ret; } @@ -3152,16 +3161,22 @@ int ObTabletFinishRestoreTask::update_restore_status_() int ObTabletFinishRestoreTask::record_server_event_() { int ret = OB_SUCCESS; + ObTabletGroupRestoreCtx *tablet_group_ctx = nullptr; if (OB_ISNULL(tablet_restore_ctx_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("ctx should not be null", K(ret)); + } else if (OB_ISNULL(ha_dag_net_ctx_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("dag net ctx should not be null", K(ret)); + } else if (FALSE_IT(tablet_group_ctx = static_cast(ha_dag_net_ctx_))) { } else { SERVER_EVENT_ADD("storage_ha", "tablet_finish_restore_task", "tenant_id", tablet_restore_ctx_->tenant_id_, "ls_id", tablet_restore_ctx_->ls_id_.id(), "tablet_id", tablet_restore_ctx_->tablet_id_.id(), "action", ObTabletRestoreAction::get_action_str(tablet_restore_ctx_->action_), - "is_leader", tablet_restore_ctx_->is_leader_); + "is_leader", tablet_restore_ctx_->is_leader_, + "task_id", tablet_group_ctx->task_id_); } return ret; }