From f9b4a0cd853838c46cb0a11fd8ee5e3e14c3601c Mon Sep 17 00:00:00 2001 From: godyangfight Date: Mon, 22 Jul 2024 04:36:30 +0000 Subject: [PATCH] Fix transfer backfill failed inner retry init tablet handler bug. --- .../ob_tablet_backfill_tx.cpp | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/storage/high_availability/ob_tablet_backfill_tx.cpp b/src/storage/high_availability/ob_tablet_backfill_tx.cpp index 0527e258b2..90ed70324d 100644 --- a/src/storage/high_availability/ob_tablet_backfill_tx.cpp +++ b/src/storage/high_availability/ob_tablet_backfill_tx.cpp @@ -30,6 +30,7 @@ namespace storage { ERRSIM_POINT_DEF(EN_TRANSFER_BACKFILL_DATA_ERROR); +ERRSIM_POINT_DEF(EN_UPDATE_TRANSFER_TABLET_TABLE_ERROR); /******************ObBackfillTXCtx*********************/ ObBackfillTXCtx::ObBackfillTXCtx() : task_id_(), @@ -412,9 +413,6 @@ int ObTabletBackfillTXDag::inner_reset_status_for_retry() ObBackfillTXCtx *ctx = nullptr; int32_t result = OB_SUCCESS; int32_t retry_count = 0; - ObLS *ls = nullptr; - ObLSService *ls_service = nullptr; - ObLSHandle ls_handle; if (!is_inited_) { ret = OB_NOT_INIT; @@ -443,16 +441,6 @@ int ObTabletBackfillTXDag::inner_reset_status_for_retry() } if (OB_FAIL(ret)) { - } else if (OB_ISNULL(ls_service = MTL(ObLSService*))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("failed to get ObLSService from MTL", K(ret), KP(ls_service)); - } else if (OB_FAIL(ls_service->get_ls(ls_id_, ls_handle, ObLSGetMod::HA_MOD))) { - LOG_WARN("failed to get ls", K(ret), K(ls_id_)); - } else if (OB_ISNULL(ls = ls_handle.get_ls())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("ls should not be NULL", K(ret), KP(ls), K(ls_id_)); - } else if (OB_FAIL(ls->ha_get_tablet(tablet_info_.tablet_id_, tablet_handle_))) { - LOG_WARN("failed to get tablet", K(ret), K(tablet_info_)); } else if (OB_FAIL(create_first_task())) { LOG_WARN("failed to create first task", K(ret), KPC(this)); } @@ -553,6 +541,22 @@ int ObTabletBackfillTXTask::process() LOG_WARN("failed to generate backfill tx task", K(ret), KPC(ha_dag_net_ctx_), K(ls_id_), K(tablet_info_)); } +#ifdef ERRSIM + if (OB_SUCC(ret)) { + ret = EN_UPDATE_TRANSFER_TABLET_TABLE_ERROR ? : OB_SUCCESS; + if (OB_FAIL(ret)) { + STORAGE_LOG(WARN, "fake EN_UPDATE_TRANSFER_TABLET_TABLE_ERROR", K(ret)); + SERVER_EVENT_ADD("TRANSFER", "UPDATE_TRANSFER_TABLET_TABLE", + "task_id", backfill_tx_ctx_->task_id_, + "tenant_id", MTL_ID(), + "src_ls_id", backfill_tx_ctx_->ls_id_, + "dest_ls_id", "", + "tablet_id", tablet_info_.tablet_id_, + "result", ret); + } + } +#endif + if (OB_FAIL(ret)) { int tmp_ret = OB_SUCCESS; ObTabletBackfillTXDag *tablet_backfill_tx_dag = static_cast(this->get_dag());