diff --git a/deps/oblib/src/lib/allocator/ob_cached_allocator.h b/deps/oblib/src/lib/allocator/ob_cached_allocator.h index de722b79ca..c5d8d9cfaf 100644 --- a/deps/oblib/src/lib/allocator/ob_cached_allocator.h +++ b/deps/oblib/src/lib/allocator/ob_cached_allocator.h @@ -29,7 +29,7 @@ public: virtual ~ObCachedAllocator(); T *alloc(); - void free(T *obj); + void free(T *obj, bool can_reuse = true); int32_t get_allocated_count() const {return allocated_count_;}; int32_t get_cached_count() const {return cached_count_;}; private: @@ -88,12 +88,16 @@ T *ObCachedAllocator::alloc() } template -void ObCachedAllocator::free(T *obj) +void ObCachedAllocator::free(T *obj, bool can_reuse) { if (OB_LIKELY(NULL != obj)) { int ret = OB_SUCCESS; ObSpinLockGuard guard(lock_); - if (OB_FAIL(cached_objs_.push_back(obj))) { + if (!can_reuse) { + // free directly + obj->~T(); + pool_.free(obj); + } else if (OB_FAIL(cached_objs_.push_back(obj))) { LIB_LOG(ERROR, "failed to push obj into array", K(ret)); // free directly obj->~T(); diff --git a/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.cpp b/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.cpp index 58e4adb3f9..517080c1ec 100644 --- a/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.cpp +++ b/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.cpp @@ -446,7 +446,7 @@ int ObDbLinkProxy::create_dblink_pool(uint64_t tenant_id, uint64_t dblink_id, Db return ret; } -int ObDbLinkProxy::acquire_dblink(uint64 tenant_id, uint64_t dblink_id, +int ObDbLinkProxy::acquire_dblink(uint64_t tenant_id, uint64_t dblink_id, DblinkDriverProto dblink_type, const dblink_param_ctx ¶m_ctx, ObISQLConnection *&dblink_conn, diff --git a/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.h b/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.h index 8870902e95..ac29cdcb0e 100644 --- a/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.h +++ b/deps/oblib/src/lib/mysqlclient/ob_mysql_proxy.h @@ -172,7 +172,7 @@ public: const common::ObString &conn_str, const common::ObString &cluster_str, const sqlclient::dblink_param_ctx ¶m_ctx); - int acquire_dblink(uint64 tenant_id, uint64_t dblink_id, + int acquire_dblink(uint64_t tenant_id, uint64_t dblink_id, sqlclient::DblinkDriverProto dblink_type, const sqlclient::dblink_param_ctx ¶m_ctx, sqlclient::ObISQLConnection *&dblink_conn,