fix tenant mtl module register with MTL_BIND2 remove old MTL_BIND

This commit is contained in:
obdev
2024-02-08 11:57:54 +00:00
committed by ob-robot
parent 535924fba1
commit 883414e5c3
15 changed files with 76 additions and 72 deletions

View File

@ -38,7 +38,7 @@ ObTenantDfc::ObTenantDfc(uint64_t tenant_id)
ObTenantDfc::~ObTenantDfc()
{}
int ObTenantDfc::mtl_init(ObTenantDfc *&tenant_dfc)
int ObTenantDfc::mtl_new(ObTenantDfc *&tenant_dfc)
{
int ret = OB_SUCCESS;
uint64_t tenant_id = MTL_ID();
@ -47,7 +47,16 @@ int ObTenantDfc::mtl_init(ObTenantDfc *&tenant_dfc)
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc tenant dfc", K(ret));
} else if (FALSE_IT(new (tenant_dfc) ObTenantDfc(tenant_id))) {
} else {
}
return ret;
}
int ObTenantDfc::mtl_init(ObTenantDfc *&tenant_dfc)
{
int ret = OB_SUCCESS;
uint64_t tenant_id = MTL_ID();
if (OB_SUCC(ret)) {
tenant_dfc->channel_total_cnt_ = 0;
tenant_dfc->blocked_dfc_cnt_ = 0;
tenant_dfc->max_parallel_cnt_ = 0;
@ -60,14 +69,6 @@ int ObTenantDfc::mtl_init(ObTenantDfc *&tenant_dfc)
// tenant_dfc->calc_max_buffer(10);
LOG_INFO("init tenant dfc", K(ret), K(tenant_dfc->tenant_id_));
}
if (OB_FAIL(ret)) {
if (nullptr != tenant_dfc) {
tenant_dfc->tenant_mem_mgr_.destroy();
common::ob_delete(tenant_dfc);
tenant_dfc = nullptr;
}
LOG_WARN("failed to mtl init", K(ret));
}
return ret;
}

View File

@ -36,6 +36,7 @@ public:
ObTenantDfc(uint64_t tenant_id);
virtual ~ObTenantDfc();
public:
static int mtl_new(ObTenantDfc *&tenant_dfc);
static int mtl_init(ObTenantDfc *&tenant_dfc);
static void mtl_destroy(ObTenantDfc *&tenant_dfc);

View File

@ -326,12 +326,10 @@ int ObTenantSqlMemoryManager::ObSqlWorkAreaCalcInfo::calculate_global_bound_size
return ret;
}
////////////////////////////////////////////////////////////////////////////////////
int ObTenantSqlMemoryManager::mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr)
int ObTenantSqlMemoryManager::mtl_new(ObTenantSqlMemoryManager *&sql_mem_mgr)
{
int ret = OB_SUCCESS;
uint64_t tenant_id = MTL_ID();
sql_mem_mgr = nullptr;
// 系统租户不创建
if (OB_MAX_RESERVED_TENANT_ID < tenant_id) {
sql_mem_mgr = OB_NEW(ObTenantSqlMemoryManager,
@ -339,7 +337,19 @@ int ObTenantSqlMemoryManager::mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr)
if (nullptr == sql_mem_mgr) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc tenant sql memory manager", K(ret));
} else if (OB_FAIL(sql_mem_mgr->allocator_.init(
}
}
return ret;
}
////////////////////////////////////////////////////////////////////////////////////
int ObTenantSqlMemoryManager::mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr)
{
int ret = OB_SUCCESS;
uint64_t tenant_id = MTL_ID();
// 系统租户不init
if (OB_MAX_RESERVED_TENANT_ID < tenant_id) {
if (OB_FAIL(sql_mem_mgr->allocator_.init(
lib::ObMallocAllocator::get_instance(),
OB_MALLOC_NORMAL_BLOCK_SIZE,
ObMemAttr(tenant_id, "SqlMemMgr")))) {

View File

@ -584,6 +584,7 @@ public:
{}
~ObTenantSqlMemoryManager() {}
public:
static int mtl_new(ObTenantSqlMemoryManager *&sql_mem_mgr);
static int mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr);
static void mtl_destroy(ObTenantSqlMemoryManager *&sql_mem_mgr);

View File

@ -81,23 +81,12 @@ namespace sql
{
int ret = OB_SUCCESS;
uint64_t tenant_id = lib::current_resource_owner_id();
span_mgr = OB_NEW(ObFLTSpanMgr, ObMemAttr(tenant_id, "SqlFltSpanRec"));
if (nullptr == span_mgr) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc memory for ObMySQLRequestManager", K(ret));
int64_t mem_limit = lib::get_tenant_memory_limit(tenant_id);
int64_t queue_size = MAX_QUEUE_SIZE;
if (OB_FAIL(span_mgr->init(tenant_id, mem_limit, queue_size))) {
LOG_WARN("failed to init request manager", K(ret));
} else {
int64_t mem_limit = lib::get_tenant_memory_limit(tenant_id);
int64_t queue_size = MAX_QUEUE_SIZE;
if (OB_FAIL(span_mgr->init(tenant_id, mem_limit, queue_size))) {
LOG_WARN("failed to init request manager", K(ret));
} else {
// do nothing
}
}
if (OB_FAIL(ret) && span_mgr != nullptr) {
// cleanup
common::ob_delete(span_mgr);
span_mgr = nullptr;
// do nothing
}
return ret;
}

View File

@ -116,7 +116,7 @@ void ObTenantSQLSessionMgr::destroy()
{
}
int ObTenantSQLSessionMgr::mtl_init(ObTenantSQLSessionMgr *&t_session_mgr)
int ObTenantSQLSessionMgr::mtl_new(ObTenantSQLSessionMgr *&t_session_mgr)
{
int ret = OB_SUCCESS;
t_session_mgr = OB_NEW(ObTenantSQLSessionMgr, ObMemAttr(MTL_ID(), "TSQLSessionMgr"),
@ -124,7 +124,14 @@ int ObTenantSQLSessionMgr::mtl_init(ObTenantSQLSessionMgr *&t_session_mgr)
if (OB_ISNULL(t_session_mgr)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc tenant session manager", K(ret));
} else if (OB_FAIL(t_session_mgr->init())) {
}
return ret;
}
int ObTenantSQLSessionMgr::mtl_init(ObTenantSQLSessionMgr *&t_session_mgr)
{
int ret = OB_SUCCESS;
if (OB_FAIL(t_session_mgr->init())) {
LOG_WARN("failed to init tenant session manager", K(ret));
}
return ret;

View File

@ -376,6 +376,7 @@ public:
int init();
void destroy();
static int mtl_new(ObTenantSQLSessionMgr *&tenant_session_mgr);
static int mtl_init(ObTenantSQLSessionMgr *&tenant_session_mgr);
static void mtl_destroy(ObTenantSQLSessionMgr *&tenant_session_mgr);
ObSQLSessionInfo *alloc_session();