From 82be6c8d8d5b1dec488c99e17108564fa5ae4506 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 26 Oct 2022 10:30:08 +0800 Subject: [PATCH] set filled_tx_log_ts more precise && skip inner tablet when get min end ts in old tablets --- src/storage/compaction/ob_tablet_merge_ctx.cpp | 17 +++++++++++++++-- src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/storage/compaction/ob_tablet_merge_ctx.cpp b/src/storage/compaction/ob_tablet_merge_ctx.cpp index 44787569f4..3dae5e260a 100644 --- a/src/storage/compaction/ob_tablet_merge_ctx.cpp +++ b/src/storage/compaction/ob_tablet_merge_ctx.cpp @@ -267,14 +267,27 @@ int ObTabletMergeInfo::record_start_tx_scn_for_tx_data(const ObTabletMergeCtx &c } else if (ctx.param_.is_minor_merge()) { // when this merege is MINOR_MERGE or MINI_MINOR_MERGE, use max_filtered_end_scn in filter if filtered some tx data ObTransStatusFilter *compaction_filter_ = (ObTransStatusFilter*)ctx.compaction_filter_; - if (OB_ISNULL(compaction_filter_)) { + ObSSTable *oldest_tx_data_sstable = static_cast(ctx.tables_handle_.get_table(0)); + if (OB_ISNULL(oldest_tx_data_sstable)) { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("tx data sstable is unexpected nullptr", KR(ret)); + } else if (OB_ISNULL(compaction_filter_)) { // This minor merge do not filter any tx data - param.filled_tx_log_ts_ = ctx.log_ts_range_.start_log_ts_; + param.filled_tx_log_ts_ = oldest_tx_data_sstable->get_filled_tx_scn(); } else if (compaction_filter_->get_max_filtered_end_scn() > 0) { param.filled_tx_log_ts_ = compaction_filter_->get_max_filtered_end_scn(); } else { param.filled_tx_log_ts_ = compaction_filter_->get_recycle_scn(); } + + if (OB_SUCC(ret) && param.filled_tx_log_ts_ < oldest_tx_data_sstable->get_filled_tx_scn()) { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("invliad filled tx log ts", + KR(ret), + K(param), + K(oldest_tx_data_sstable->get_filled_tx_scn()), + KPC(oldest_tx_data_sstable)); + } } else { ret = OB_ERR_UNEXPECTED; LOG_ERROR("unexpected merge type when merge tx data table", KR(ret), K(ctx)); diff --git a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp index 9ef390e632..09bdc2d6bd 100644 --- a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp +++ b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp @@ -377,7 +377,7 @@ int ObTenantMetaMemMgr::get_min_end_log_ts_for_ls(const share::ObLSID &ls_id, in SSTableSet::const_iterator iter = last_min_minor_sstable_set_.begin(); while (OB_SUCC(ret) && iter != last_min_minor_sstable_set_.end()) { const MinMinorSSTableInfo &info = iter->first; - if (info.ls_id_ != ls_id) { + if (info.ls_id_ != ls_id || info.table_key_.tablet_id_.is_ls_inner_tablet()) { // just skip } else if (OB_UNLIKELY(!info.is_valid())) { ret = OB_ERR_UNEXPECTED; -- GitLab