From efffd594ccb43128603791a3c6c0a66fa776f314 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 15 Feb 2023 14:12:22 +0000 Subject: [PATCH] [Fix] clear ddl commit flag in DDL start redo process --- src/storage/ddl/ob_ddl_redo_log_writer.cpp | 2 ++ src/storage/ddl/ob_tablet_ddl_kv_mgr.cpp | 6 ++++++ src/storage/ddl/ob_tablet_ddl_kv_mgr.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/storage/ddl/ob_ddl_redo_log_writer.cpp b/src/storage/ddl/ob_ddl_redo_log_writer.cpp index b41227a737..7d5ccbc67f 100644 --- a/src/storage/ddl/ob_ddl_redo_log_writer.cpp +++ b/src/storage/ddl/ob_ddl_redo_log_writer.cpp @@ -1073,6 +1073,8 @@ int ObDDLSSTableRedoWriter::start_ddl_redo(const ObITable::TableKey &table_key, } else if (FALSE_IT(set_start_scn(tmp_scn))) { } else if (OB_FAIL(ddl_kv_mgr_handle.get_obj()->register_to_tablet(get_start_scn(), ddl_kv_mgr_handle))) { LOG_WARN("register ddl kv mgr to tablet failed", K(ret), K(ls_id_), K(tablet_id_)); + } else { + ddl_kv_mgr_handle.get_obj()->reset_commit_success(); // releated issue: https://work.aone.alibaba-inc.com/issue/47686927 } return ret; } diff --git a/src/storage/ddl/ob_tablet_ddl_kv_mgr.cpp b/src/storage/ddl/ob_tablet_ddl_kv_mgr.cpp index 65064b217f..ae1263667f 100644 --- a/src/storage/ddl/ob_tablet_ddl_kv_mgr.cpp +++ b/src/storage/ddl/ob_tablet_ddl_kv_mgr.cpp @@ -470,6 +470,12 @@ bool ObTabletDDLKvMgr::is_commit_success_unlock() const return success_start_scn_ > SCN::min_scn() && success_start_scn_ == start_scn_; } +void ObTabletDDLKvMgr::reset_commit_success() +{ + ObLatchWGuard guard(lock_, ObLatchIds::TABLET_DDL_KV_MGR_LOCK); + success_start_scn_.set_min(); +} + bool ObTabletDDLKvMgr::can_schedule_major_compaction(const ObTabletMeta &tablet_meta) { ObLatchRGuard guard(lock_, ObLatchIds::TABLET_DDL_KV_MGR_LOCK); diff --git a/src/storage/ddl/ob_tablet_ddl_kv_mgr.h b/src/storage/ddl/ob_tablet_ddl_kv_mgr.h index b183823de5..902135a578 100644 --- a/src/storage/ddl/ob_tablet_ddl_kv_mgr.h +++ b/src/storage/ddl/ob_tablet_ddl_kv_mgr.h @@ -57,6 +57,7 @@ public: share::SCN get_commit_scn(const ObTabletMeta &tablet_meta); int set_commit_success(const share::SCN &start_scn); bool is_commit_success(); + void reset_commit_success(); common::ObTabletID get_tablet_id() const { return tablet_id_; } share::ObLSID get_ls_id() const { return ls_id_; } int cleanup();