提交 9d750fb8 编写于 作者: Q qianchanger 提交者: wangzelin.wzl

add _max_trx_size

上级 db22b2c6
...@@ -1270,7 +1270,7 @@ DEF_BOOL(module_test_trx_fake_commit, OB_TENANT_PARAMETER, "false", "module test ...@@ -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", DEF_CAP(sql_work_area, OB_TENANT_PARAMETER, "1G", "[10M,)", "Work area memory limitation for tenant",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::STATIC_EFFECTIVE)); 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", "the limit for memstore memory used per partition involved in each database transaction",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_CAP(__easy_memory_limit, OB_CLUSTER_PARAMETER, "4G", "[1G,)", DEF_CAP(__easy_memory_limit, OB_CLUSTER_PARAMETER, "4G", "[1G,)",
......
...@@ -258,6 +258,8 @@ int ObMemtableCtx::set_host_(ObMemtable* host, const bool for_replay) ...@@ -258,6 +258,8 @@ int ObMemtableCtx::set_host_(ObMemtable* host, const bool for_replay)
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
} else if (false == for_replay && true == trans_mgr_.is_for_replay()) { } else if (false == for_replay && true == trans_mgr_.is_for_replay()) {
ret = OB_NOT_MASTER; 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()) { } else if (host == get_active_mt()) {
// do nothing // do nothing
} else if (memtable_arr_wrap_.is_contain_this_memtable(host)) { } else if (memtable_arr_wrap_.is_contain_this_memtable(host)) {
...@@ -1739,5 +1741,19 @@ void ObMemtableCtx::dec_pending_elr_count() ...@@ -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 memtable
} // namespace oceanbase } // namespace oceanbase
...@@ -569,6 +569,7 @@ private: ...@@ -569,6 +569,7 @@ private:
{ {
trans_mgr_.inc_flushed_log_size(size); trans_mgr_.inc_flushed_log_size(size);
} }
int check_trans_size_(const bool for_replay);
private: private:
DISALLOW_COPY_AND_ASSIGN(ObMemtableCtx); DISALLOW_COPY_AND_ASSIGN(ObMemtableCtx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册