From 87461a23bcccdb7568dbe2f0013ee1bd0a76a542 Mon Sep 17 00:00:00 2001 From: LiefB <954800091@qq.com> Date: Mon, 24 Jul 2023 09:18:32 +0000 Subject: [PATCH] fix error log of waiting all tablet checksum has timed out --- .../freeze/ob_checksum_validator.cpp | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/rootserver/freeze/ob_checksum_validator.cpp b/src/rootserver/freeze/ob_checksum_validator.cpp index a43f125df1..4e44a30ce1 100755 --- a/src/rootserver/freeze/ob_checksum_validator.cpp +++ b/src/rootserver/freeze/ob_checksum_validator.cpp @@ -596,29 +596,33 @@ int ObCrossClusterTabletChecksumValidator::validate_cross_cluster_checksum( LOG_WARN("invalid argument", KR(ret), K(frozen_scn), K(expected_epoch), KP(simple_schema)); } else { FREEZE_TIME_GUARD; - // check whether waiting all tablet checksum has timed out - bool is_wait_tablet_checksum_timeout = check_waiting_tablet_checksum_timeout(); - if (OB_UNLIKELY(is_wait_tablet_checksum_timeout)) { - bool is_match = true; - if (OB_FAIL(ObServiceEpochProxy::check_service_epoch(*sql_proxy_, tenant_id_, - ObServiceEpochProxy::FREEZE_SERVICE_EPOCH, expected_epoch, is_match))) { - LOG_WARN("fail to check freeze service epoch", KR(ret), K_(tenant_id), K(expected_epoch)); - } else if (!is_match) { - ret = OB_FREEZE_SERVICE_EPOCH_MISMATCH; - LOG_WARN("no need to validate cross-cluster checksum, cuz freeze_service_epoch mismatch", - K_(tenant_id), K(frozen_scn), K(expected_epoch)); - } else { - // only LOG_ERROR when freeze_service_epoch match. - // - LOG_ERROR("waiting all tablet checksum has timed out, validate cross-cluster" - " checksum with available tablet checksum" , K_(tenant_id), K(frozen_scn), - K(expected_epoch), K_(major_merge_start_us), "current_time_us", - ObTimeUtil::current_time()); + bool is_wait_tablet_checksum_timeout = false; + // check whether all tablet checksum has already exist + if (OB_FAIL(check_if_all_tablet_checksum_exist(frozen_scn))) { + LOG_WARN("fail to check if all tablet checksum exist", KR(ret), K_(tenant_id), K(frozen_scn)); + } else if (!is_all_tablet_checksum_exist_) { + // check whether waiting all tablet checksum has timed out + bool is_wait_tablet_checksum_timeout = check_waiting_tablet_checksum_timeout(); + if (OB_UNLIKELY(is_wait_tablet_checksum_timeout)) { + bool is_match = true; + if (OB_FAIL(ObServiceEpochProxy::check_service_epoch(*sql_proxy_, tenant_id_, + ObServiceEpochProxy::FREEZE_SERVICE_EPOCH, expected_epoch, is_match))) { + LOG_WARN("fail to check freeze service epoch", KR(ret), K_(tenant_id), K(expected_epoch)); + } else if (!is_match) { + ret = OB_FREEZE_SERVICE_EPOCH_MISMATCH; + LOG_WARN("no need to validate cross-cluster checksum, cuz freeze_service_epoch mismatch", + K_(tenant_id), K(frozen_scn), K(expected_epoch)); + } else { + // only LOG_ERROR when freeze_service_epoch match. + // + LOG_ERROR("waiting all tablet checksum has timed out, validate cross-cluster" + " checksum with available tablet checksum" , K_(tenant_id), K(frozen_scn), + K(expected_epoch), K_(major_merge_start_us), "current_time_us", + ObTimeUtil::current_time()); + } } } - // check whether all tablet checksum has already exist - if (FAILEDx(check_if_all_tablet_checksum_exist(frozen_scn))) { - LOG_WARN("fail to check if all tablet checksum exist", KR(ret), K_(tenant_id), K(frozen_scn)); + if (OB_FAIL(ret)) { } else if (is_all_tablet_checksum_exist_ || is_wait_tablet_checksum_timeout) { // all tablet checksum exist or timeout if (OB_FAIL(check_cross_cluster_checksum(*simple_schema, frozen_scn))) { if (OB_ITEM_NOT_MATCH == ret) {