From f2627c972ac1356155362cf3092aa79bbe50e088 Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 30 Apr 2024 04:50:57 +0000 Subject: [PATCH] check NULL for mtl_init && mtl_wait --- src/share/rc/ob_tenant_base.h | 2 +- src/sql/session/ob_sql_session_mgr.cpp | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/share/rc/ob_tenant_base.h b/src/share/rc/ob_tenant_base.h index 980c33e6dd..d635cde1b3 100755 --- a/src/share/rc/ob_tenant_base.h +++ b/src/share/rc/ob_tenant_base.h @@ -250,6 +250,7 @@ using ObTableScanIteratorObjPool = common::ObServerObjectPoolinit())) { - LOG_WARN("failed to init tenant session manager", K(ret)); + if (t_session_mgr != NULL) { + if (OB_FAIL(t_session_mgr->init())) { + LOG_WARN("failed to init tenant session manager", K(ret)); + } } return ret; } void ObTenantSQLSessionMgr::mtl_wait(ObTenantSQLSessionMgr *&t_session_mgr) { - while (t_session_mgr->count() != 0) { - LOG_WARN_RET(OB_NEED_RETRY, "tenant session mgr should be empty", - K(t_session_mgr->count())); - usleep(1000 * 1000); + if (t_session_mgr != NULL) { + while (t_session_mgr->count() != 0) { + LOG_WARN_RET(OB_NEED_RETRY, "tenant session mgr should be empty", + K(t_session_mgr->count())); + usleep(1000 * 1000); + } } LOG_INFO("success to wait tenant session mgr"); } @@ -165,7 +169,9 @@ ObSQLSessionInfo *ObTenantSQLSessionMgr::alloc_session() OX (session = op_instance_alloc_args(&session_allocator_, ObSQLSessionInfo, tenant_id_)); - OX (ATOMIC_FAA(&count_, 1)); + if (session != NULL) { + OX (ATOMIC_FAA(&count_, 1)); + } } OV (OB_NOT_NULL(session)); OX (session->set_tenant_session_mgr(this));