diff --git a/src/storage/memtable/ob_memtable.cpp b/src/storage/memtable/ob_memtable.cpp index 256d61139f8324ef8ebcbd16cd18fb08f29b3533..1eea602efccaec889ee5376e56e6835416e42fc3 100644 --- a/src/storage/memtable/ob_memtable.cpp +++ b/src/storage/memtable/ob_memtable.cpp @@ -1647,6 +1647,13 @@ bool ObMemtable::ready_for_flush_() int ret = OB_SUCCESS; SCN current_right_boundary = ObScnRange::MIN_SCN; share::ObLSID ls_id = freezer_->get_ls_id(); + const SCN migration_clog_checkpoint_scn = get_migration_clog_checkpoint_scn(); + if (!migration_clog_checkpoint_scn.is_min() && + migration_clog_checkpoint_scn >= get_end_scn() && + 0 != get_unsynced_cnt() && + multi_source_data_.get_all_unsync_cnt_for_multi_data() == get_unsynced_cnt()) { + bool_ret = true; + } if (bool_ret) { if (OB_FAIL(resolve_snapshot_version_())) { TRANS_LOG(WARN, "fail to resolve snapshot version", K(ret), KPC(this), K(ls_id)); diff --git a/src/storage/memtable/ob_multi_source_data.cpp b/src/storage/memtable/ob_multi_source_data.cpp index 68b538a1ecffbd2e585b2918e69bdd430413117d..a31c48dc4709b50a10cdc1622816fbaba2eadc26 100644 --- a/src/storage/memtable/ob_multi_source_data.cpp +++ b/src/storage/memtable/ob_multi_source_data.cpp @@ -223,5 +223,20 @@ int ObMultiSourceData::get_unsync_cnt_for_multi_data(const MultiSourceDataUnitTy return ret; } +int64_t ObMultiSourceData::get_all_unsync_cnt_for_multi_data() +{ + int ret = OB_SUCCESS; + int64_t unsynced_cnt_for_multi_data = 0; + + for (int i = 0; i < MAX_PTR_COUNT; ++i) { + ObIMultiSourceDataUnit *value = units_[i]; + if (nullptr != value && value->is_valid()) { + int64_t cnt = value->get_unsync_cnt_for_multi_data(); + unsynced_cnt_for_multi_data += cnt; + } + } + + return unsynced_cnt_for_multi_data; +} } // namespace memtable } // namespace oceanbase diff --git a/src/storage/memtable/ob_multi_source_data.h b/src/storage/memtable/ob_multi_source_data.h index c3700b3f6f23ae981e0c8f86bf5eb0a718fb67a3..0365cf03bfcf23f5ab1165c74130ec484cf0bab9 100644 --- a/src/storage/memtable/ob_multi_source_data.h +++ b/src/storage/memtable/ob_multi_source_data.h @@ -128,6 +128,7 @@ public: int save_multi_source_data_unit(const T *const src, bool is_callback); int update_unsync_cnt_for_multi_data(const MultiSourceDataUnitType multi_source_type, const bool is_inc); int get_unsync_cnt_for_multi_data(const MultiSourceDataUnitType multi_source_type, int &unsynced_cnt_for_multi_data); + int64_t get_all_unsync_cnt_for_multi_data(); private: int inner_mark_unit_sync_finish( const int64_t unit_type,