diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index be59c5595ccdd711b16025323b344f0e7053818d..9ad08742ffcac8decbda189177c51ef344fa52b8 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -1270,7 +1270,7 @@ DEF_BOOL(module_test_trx_fake_commit, OB_TENANT_PARAMETER, "false", "module test DEF_CAP(sql_work_area, OB_TENANT_PARAMETER, "1G", "[10M,)", "Work area memory limitation for tenant", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE)); -DEF_CAP(_max_trx_size, OB_CLUSTER_PARAMETER, "100G", "[1M,)", +DEF_CAP(_max_trx_size, OB_CLUSTER_PARAMETER, "100G", "[0B,)", "the limit for memstore memory used per partition involved in each database transaction", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); DEF_CAP(__easy_memory_limit, OB_CLUSTER_PARAMETER, "4G", "[1G,)", diff --git a/src/storage/memtable/ob_memtable_context.cpp b/src/storage/memtable/ob_memtable_context.cpp index fbe63aeee60277cf78d11f4f19402ae48694478b..73ded0ac40c8bd183cdccb51e4a14d412e20266a 100644 --- a/src/storage/memtable/ob_memtable_context.cpp +++ b/src/storage/memtable/ob_memtable_context.cpp @@ -258,6 +258,8 @@ int ObMemtableCtx::set_host_(ObMemtable* host, const bool for_replay) ret = OB_ERR_UNEXPECTED; } else if (false == for_replay && true == trans_mgr_.is_for_replay()) { ret = OB_NOT_MASTER; + } else if (!ctx_->is_can_elr() && OB_FAIL(check_trans_size_(for_replay))) { + // do nothing } else if (host == get_active_mt()) { // do nothing } else if (memtable_arr_wrap_.is_contain_this_memtable(host)) { @@ -1739,5 +1741,19 @@ void ObMemtableCtx::dec_pending_elr_count() } } +int ObMemtableCtx::check_trans_size_(const bool for_replay) +{ + int ret = OB_SUCCESS; + const int64_t max_trx_size = GCONF._max_trx_size; + if (!for_replay && !is_can_elr()) { + if (max_trx_size > 0 && trans_mem_total_size_ > max_trx_size) { + ret = OB_TRANS_OUT_OF_THRESHOLD; + TRANS_LOG(WARN, "current transaction partition data size great to threshold", K(*this), + K(ret), K_(trans_mem_total_size), "max_trx_size_threshold", max_trx_size); + } + } + return ret; +} + } // namespace memtable } // namespace oceanbase diff --git a/src/storage/memtable/ob_memtable_context.h b/src/storage/memtable/ob_memtable_context.h index ddf3ea40266f51f6bae2db8cdd46d9626254c17f..3a07c21c64205af7b41a6d3b9f97871278f6ea82 100644 --- a/src/storage/memtable/ob_memtable_context.h +++ b/src/storage/memtable/ob_memtable_context.h @@ -569,6 +569,7 @@ private: { trans_mgr_.inc_flushed_log_size(size); } + int check_trans_size_(const bool for_replay); private: DISALLOW_COPY_AND_ASSIGN(ObMemtableCtx);