From ead52c09f3d5a6d303cd0e3b634acf34fd44fb29 Mon Sep 17 00:00:00 2001 From: Handora Date: Thu, 9 Feb 2023 14:31:37 +0000 Subject: [PATCH] [BUG] remove error for 6213 in mvcc gc --- .../ob_multi_version_garbage_collector.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/storage/concurrency_control/ob_multi_version_garbage_collector.cpp b/src/storage/concurrency_control/ob_multi_version_garbage_collector.cpp index 64881378e5..df10f411cb 100644 --- a/src/storage/concurrency_control/ob_multi_version_garbage_collector.cpp +++ b/src/storage/concurrency_control/ob_multi_version_garbage_collector.cpp @@ -432,10 +432,22 @@ int ObMultiVersionGarbageCollector::study_min_unallocated_WRS( { int ret = OB_SUCCESS; + const int64_t current_time = ObTimeUtility::current_time(); + const int64_t max_read_stale_time = + transaction::ObWeakReadUtil::max_stale_time_for_weak_consistency(MTL_ID()); + if (OB_FAIL(MTL(transaction::ObTransService*)->get_weak_read_snapshot_version( - transaction::ObWeakReadUtil::max_stale_time_for_weak_consistency(MTL_ID()), + max_read_stale_time, min_unallocated_WRS))) { MVCC_LOG(WARN, "fail to get weak read snapshot", K(ret)); + if (OB_REPLICA_NOT_READABLE == ret) { + // The global weak read service cannot provide services in some cases(for + // example backup cluster's weak read service may hung during recovery). + // So instead of report the error, we decide to use the max allowed stale + // time for garbage collector. + min_unallocated_WRS.convert_from_ts(current_time - max_read_stale_time); + ret = OB_SUCCESS; + } } return ret;