From 7b0bdb407bb17b5767afa819f81ccac6d28db608 Mon Sep 17 00:00:00 2001 From: nroskill Date: Fri, 5 May 2023 10:08:18 +0000 Subject: [PATCH] fix coredump in switch_tenant when oom --- deps/oblib/src/lib/stat/ob_session_stat.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deps/oblib/src/lib/stat/ob_session_stat.h b/deps/oblib/src/lib/stat/ob_session_stat.h index bf133b9949..f12f3062b5 100644 --- a/deps/oblib/src/lib/stat/ob_session_stat.h +++ b/deps/oblib/src/lib/stat/ob_session_stat.h @@ -81,7 +81,9 @@ public: if (NULL != buffer_) { prev_tenant_id_ = buffer_->get_tenant_id(); if (0 < tenant_id) { - buffer_->switch_tenant(tenant_id); + if (OB_UNLIKELY(OB_SUCCESS != buffer_->switch_tenant(tenant_id))) { + buffer_ = nullptr; + } } } } else { @@ -138,7 +140,8 @@ inline int ObSessionDIBuffer::switch_tenant(const uint64_t tenant_id) if (OB_SYS_TENANT_ID == tenant_id) { curr_tenant_collect_ = sys_tenant_collect_; } else { - if (tenant_id == not_sys_tenant_collect_->tenant_id_) { + if (OB_NOT_NULL(not_sys_tenant_collect_) + && tenant_id == not_sys_tenant_collect_->tenant_id_) { } else { ret = tenant_cache_.get_node(tenant_id, not_sys_tenant_collect_); }