add _max_dblink_conn_per_observer cfg.

This commit is contained in:
cqliang1995 2024-12-10 09:45:32 +00:00 committed by ob-robot
parent 4b748f9c6d
commit 46c2dc34e4
6 changed files with 18 additions and 2 deletions

View File

@ -49,6 +49,11 @@ uint64_t __attribute__((weak)) get_current_tenant_id_for_dblink()
return oceanbase::OB_INVALID_ID;
}
uint64_t __attribute__((weak)) get_max_dblink_conn_per_observer()
{
return 256;
}
namespace oceanbase
{
namespace common

View File

@ -19,6 +19,7 @@
extern bool get_dblink_reuse_connection_cfg();
extern bool get_enable_dblink_cfg();
extern uint64_t get_current_tenant_id_for_dblink();
extern uint64_t get_max_dblink_conn_per_observer();
namespace oceanbase
{

View File

@ -210,6 +210,7 @@ int ObServerConnectionPool::init_dblink(uint64_t tenant_id, uint64_t dblink_id,
ObMySQLConnectionPool *root, int64_t max_allowed_conn_count)
{
UNUSED(conn_str);
UNUSED(max_allowed_conn_count);
int ret = OB_SUCCESS;
if (OB_ISNULL(root)) {
ret = OB_INVALID_ARGUMENT;
@ -236,7 +237,7 @@ int ObServerConnectionPool::init_dblink(uint64_t tenant_id, uint64_t dblink_id,
root_ = root;
last_renew_timestamp_ = ::oceanbase::common::ObTimeUtility::current_time();
server_not_available_ = false;
max_allowed_conn_count_ = max_allowed_conn_count;
max_allowed_conn_count_ = get_max_dblink_conn_per_observer();
connection_pool_ptr_ = &dblink_connection_pool_;
if (cluster_str.empty()) {
(void)snprintf(db_user_, sizeof(db_user_), "%.*s@%.*s", db_user.length(), db_user.ptr(),

View File

@ -1933,7 +1933,9 @@ DEF_BOOL(_enable_dblink_reuse_connection, OB_TENANT_PARAMETER, "True",
DEF_INT(_with_subquery, OB_TENANT_PARAMETER, "0", "[0,2]",
"WITH subquery transformation,0: optimizer,1: materialize,2: inline",
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_INT(_max_dblink_conn_per_observer, OB_TENANT_PARAMETER, "256", "[0,)",
"The maximum limit on the number of connections that can be opened simultaneously for a specific observer for any DBLink, default value is 256",
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_BOOL(_xsolapi_generate_with_clause, OB_TENANT_PARAMETER, "True",
"OLAP API generates WITH clause",
ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));

View File

@ -44,6 +44,12 @@ bool get_enable_dblink_cfg()
return GCONF.enable_dblink;
}
uint64_t get_max_dblink_conn_per_observer()
{
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID()));
return tenant_config.is_valid() ? tenant_config->_max_dblink_conn_per_observer : 256;
}
uint64_t get_current_tenant_id_for_dblink()
{
return MTL_ID();

View File

@ -422,6 +422,7 @@ _lob_rowsets_max_rows
_log_writer_parallelism
_ls_gc_wait_readonly_tx_time
_ls_migration_wait_completing_timeout
_max_dblink_conn_per_observer
_max_elr_dependent_trx_count
_max_ls_cnt_per_server
_max_malloc_sample_interval