diff --git a/deps/oblib/src/lib/allocator/ob_mod_define.h b/deps/oblib/src/lib/allocator/ob_mod_define.h index a31918e65d2fb2118a1f579795c65e1e13442b6c..9b162157dfbe021cea777a6646b14761901cc5d9 100644 --- a/deps/oblib/src/lib/allocator/ob_mod_define.h +++ b/deps/oblib/src/lib/allocator/ob_mod_define.h @@ -1060,7 +1060,7 @@ LABEL_ITEM_DEF(OB_TRANS_FREEZE_TASK, TransFreezeTask) LABEL_ITEM_DEF(OB_TRANS_SCHE_CTX, TransScheCtx) LABEL_ITEM_DEF(OB_TRANS_COORD_CTX, TransCoordCtx) LABEL_ITEM_DEF(OB_TRANS_PART_CTX, TransPartCtx) -LABEL_ITEM_DEF(OB_TRANS_LOCAL_TASK, TransLocalTask) +LABEL_ITEM_DEF(OB_TRANS_RPC_TASK, TransRpcTask) LABEL_ITEM_DEF(OB_TRANS_WAIT_TASK, TransWaitTask) LABEL_ITEM_DEF(OB_TRANS_TENANT_WAIT_QUEUE, TranTenaWaitQue) LABEL_ITEM_DEF(OB_GTS_TASK, GtsTask) diff --git a/src/storage/transaction/ob_trans_factory.cpp b/src/storage/transaction/ob_trans_factory.cpp index 3f8867c062c049be218fa58dd3062610f663d8b0..2512b697b6eece266b19e3d6a08ef5cb042f39c1 100644 --- a/src/storage/transaction/ob_trans_factory.cpp +++ b/src/storage/transaction/ob_trans_factory.cpp @@ -48,8 +48,6 @@ int64_t ObPartitionTransCtxMgrFactory::alloc_count_ = 0; int64_t ObPartitionTransCtxMgrFactory::release_count_ = 0; const char* ObPartitionTransCtxMgrFactory::mod_type_ = "OB_PARTITION_TRANS_CTX_MGR"; -static TransObjFactory trans_rpc_task_factory("OB_TRANS_RPC_TASK"); - #define OB_FREE(object, ...) ob_free(object) #define RP_FREE(object, LABEL) rp_free(object, LABEL) #define OB_ALLOC(object, LABEL) object##alloc() @@ -258,42 +256,12 @@ const char* ObPartitionTransCtxMgrFactory::get_mod_type() return mod_type_; } -// TransRpcTaskFactory -TransRpcTask* TransRpcTaskFactory::alloc() -{ - return trans_rpc_task_factory.alloc(); -} - -void TransRpcTaskFactory::release(TransRpcTask* task) -{ - if (OB_ISNULL(task)) { - TRANS_LOG(ERROR, "TransRpcTask pointer is null when released", KP(task)); - } else { - trans_rpc_task_factory.release(task); - task = NULL; - } -} - -int64_t TransRpcTaskFactory::get_alloc_count() -{ - return trans_rpc_task_factory.get_alloc_count(); -} - -int64_t TransRpcTaskFactory::get_release_count() -{ - return trans_rpc_task_factory.get_release_count(); -} - -const char* TransRpcTaskFactory::get_mod_type() -{ - return trans_rpc_task_factory.get_mod_type(); -} - MAKE_OB_ALLOC(ObDupTablePartitionMgr, OB_DUP_TABLE_PARTITION_MGR) MAKE_OB_ALLOC(ObGtsRpcProxy, OB_GTS_RPC_PROXY) MAKE_OB_ALLOC(ObGtsRequestRpc, OB_GTS_REQUEST_RPC) MAKE_FACTORY_CLASS_IMPLEMENT_USE_RP_ALLOC(ClogBuf, OB_TRANS_CLOG_BUF) +MAKE_FACTORY_CLASS_IMPLEMENT_USE_RP_ALLOC(TransRpcTask, OB_TRANS_RPC_TASK) MAKE_FACTORY_CLASS_IMPLEMENT_USE_RP_ALLOC(MutatorBuf, OB_TRANS_MUTATOR_BUF) MAKE_FACTORY_CLASS_IMPLEMENT_USE_RP_ALLOC(SubmitLogTask, OB_TRANS_SUBMIT_LOG_TASK) MAKE_FACTORY_CLASS_IMPLEMENT_USE_RP_ALLOC(AllocLogIdTask, OB_TRANS_ALLOC_LOG_ID_TASK) diff --git a/src/storage/transaction/ob_trans_factory.h b/src/storage/transaction/ob_trans_factory.h index db3e90760d985022b0d9ed91586bf8f0f2f68d72..a2b061bf80fcc54b03d4bceff9661e8c455d95f2 100644 --- a/src/storage/transaction/ob_trans_factory.h +++ b/src/storage/transaction/ob_trans_factory.h @@ -74,74 +74,6 @@ private: static int64_t total_release_part_ctx_count_; }; -template -class TransObjFactory { -public: - explicit TransObjFactory(const char* mod_type) : alloc_count_(0), release_count_(0) - { - (void)snprintf(mod_type_, sizeof(mod_type_) - 1, "%s", mod_type); - } - ~TransObjFactory() - {} - T* alloc(); - void release(T* obj); - int64_t get_alloc_count() - { - return alloc_count_; - } - int64_t get_release_count() - { - return release_count_; - } - char* get_mod_type() - { - return mod_type_; - } - -private: - static const int64_t MOD_TYPE_SIZE = 64; - char mod_type_[MOD_TYPE_SIZE]; - int64_t alloc_count_; - int64_t release_count_; -}; - -template -T* TransObjFactory::alloc() -{ - T* task = NULL; - - if (REACH_TIME_INTERVAL(STATISTIC_INTERVAL)) { - TRANS_LOG(INFO, - "transaction memory statistics", - "mod_type", - mod_type_, - K_(alloc_count), - K_(release_count), - "used", - alloc_count_ - release_count_); - } - - if (NULL == (task = op_reclaim_alloc(T))) { - TRANS_LOG(WARN, "obj alloc fail", KP(task)); - } else { - (void)ATOMIC_FAA(&alloc_count_, 1); - } - - return task; -} - -template -void TransObjFactory::release(T* obj) -{ - if (NULL == obj) { - TRANS_LOG(ERROR, "task which should be released is null"); - } else { - op_reclaim_free(obj); - obj = NULL; - (void)ATOMIC_FAA(&release_count_, 1); - } -} - #define MAKE_FACTORY_CLASS_DEFINE_(object_name, object_name2) \ class object_name##Factory { \ public: \