From fa9b5fdfc0b7ef68fd8c8a77d7c3dc2442f1a1a3 Mon Sep 17 00:00:00 2001 From: wxhwang Date: Thu, 4 Nov 2021 18:00:57 +0800 Subject: [PATCH] fix prepare tenant during stop archive --- deps/oblib/src/lib/utility/ob_tracepoint.h | 1 + src/rootserver/ob_log_archive_scheduler.cpp | 15 ++++++++++++++- src/share/ob_debug_sync_point.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/deps/oblib/src/lib/utility/ob_tracepoint.h b/deps/oblib/src/lib/utility/ob_tracepoint.h index 8bce12634..a92ed3894 100644 --- a/deps/oblib/src/lib/utility/ob_tracepoint.h +++ b/deps/oblib/src/lib/utility/ob_tracepoint.h @@ -445,6 +445,7 @@ public: EN_BACKUP_UPDATE_START_REPLAY_LOG_TS = 183, EN_BACKUP_BACKUPSET_DO_SCHEDULE = 184, EN_BACKUP_CHECK_BACKUP_POINT_EXIST = 185, + EN_STOP_TENANT_LOG_ARCHIVE_BACKUP = 186, // 下面请从201开始 EN_CHECK_STANDBY_CLUSTER_SCHEMA_CONDITION = 201, EN_ALLOCATE_LOB_BUF_FAILED = 202, diff --git a/src/rootserver/ob_log_archive_scheduler.cpp b/src/rootserver/ob_log_archive_scheduler.cpp index b5cc66f56..f2ef5a5a5 100644 --- a/src/rootserver/ob_log_archive_scheduler.cpp +++ b/src/rootserver/ob_log_archive_scheduler.cpp @@ -1379,6 +1379,12 @@ int ObLogArchiveScheduler::prepare_new_tenant_info_(const share::ObLogArchiveBac LOG_ERROR("not inited", K(ret)); } else if (ObLogArchiveStatus::STOP == sys_info.status_.status_) { // do nothing for stop status + } else if (ObLogArchiveStatus::STOPPING == sys_info.status_.status_) { + // do nothing for stopping status + LOG_INFO("no need to prepare new tenant when sys tenant in STOPPING state", + K(sys_info), + K(non_frozen_piece), + K(tenant_ids)); } else { for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids.count(); ++i) { const uint64_t tenant_id = tenant_ids.at(i); @@ -2431,7 +2437,14 @@ int ObLogArchiveScheduler::do_stop_tenant_log_archive_backup_v2_( const uint64_t tenant_id = cur_key.tenant_id_; max_ts = -1; - if (!is_inited_) { + DEBUG_SYNC(BEFROE_DO_STOP_TENANT_ARCHIVE); + +#ifdef ERRSIM + ret = E(EventTable::EN_STOP_TENANT_LOG_ARCHIVE_BACKUP) OB_SUCCESS; +#endif + + if (OB_FAIL(ret)) { + } else if (!is_inited_) { ret = OB_NOT_INIT; LOG_ERROR("not inited", K(ret)); } else if (OB_FAIL(check_can_do_work_())) { diff --git a/src/share/ob_debug_sync_point.h b/src/share/ob_debug_sync_point.h index 76078b953..d409348a7 100644 --- a/src/share/ob_debug_sync_point.h +++ b/src/share/ob_debug_sync_point.h @@ -184,6 +184,7 @@ class ObString; ACT(BLOCK_FREEZE_INFO_UPDATE, ) \ ACT(BEFROE_DO_ROOT_BACKUP, ) \ ACT(BEFROE_DO_LOG_ARCHIVE_SCHEDULER, ) \ + ACT(BEFROE_DO_STOP_TENANT_ARCHIVE, ) \ ACT(WRTIE_EXTERN_LOG_ARCHIVE_BACKUP_INFO, ) \ ACT(FAILED_TO_PROCESS_TO_PRIMARY, ) \ ACT(BEFORE_REFRESH_CLUSTER_ID, ) \ -- GitLab