fix reuse dblink conn pool of dropped tenant bug
This commit is contained in:
@ -29,7 +29,7 @@ public:
|
|||||||
virtual ~ObCachedAllocator();
|
virtual ~ObCachedAllocator();
|
||||||
|
|
||||||
T *alloc();
|
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_allocated_count() const {return allocated_count_;};
|
||||||
int32_t get_cached_count() const {return cached_count_;};
|
int32_t get_cached_count() const {return cached_count_;};
|
||||||
private:
|
private:
|
||||||
@ -88,12 +88,16 @@ T *ObCachedAllocator<T>::alloc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ObCachedAllocator<T>::free(T *obj)
|
void ObCachedAllocator<T>::free(T *obj, bool can_reuse)
|
||||||
{
|
{
|
||||||
if (OB_LIKELY(NULL != obj)) {
|
if (OB_LIKELY(NULL != obj)) {
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObSpinLockGuard guard(lock_);
|
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));
|
LIB_LOG(ERROR, "failed to push obj into array", K(ret));
|
||||||
// free directly
|
// free directly
|
||||||
obj->~T();
|
obj->~T();
|
||||||
|
@ -446,7 +446,7 @@ int ObDbLinkProxy::create_dblink_pool(uint64_t tenant_id, uint64_t dblink_id, Db
|
|||||||
return ret;
|
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,
|
DblinkDriverProto dblink_type,
|
||||||
const dblink_param_ctx ¶m_ctx,
|
const dblink_param_ctx ¶m_ctx,
|
||||||
ObISQLConnection *&dblink_conn,
|
ObISQLConnection *&dblink_conn,
|
||||||
|
@ -172,7 +172,7 @@ public:
|
|||||||
const common::ObString &conn_str,
|
const common::ObString &conn_str,
|
||||||
const common::ObString &cluster_str,
|
const common::ObString &cluster_str,
|
||||||
const sqlclient::dblink_param_ctx ¶m_ctx);
|
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,
|
sqlclient::DblinkDriverProto dblink_type,
|
||||||
const sqlclient::dblink_param_ctx ¶m_ctx,
|
const sqlclient::dblink_param_ctx ¶m_ctx,
|
||||||
sqlclient::ObISQLConnection *&dblink_conn,
|
sqlclient::ObISQLConnection *&dblink_conn,
|
||||||
|
Reference in New Issue
Block a user