From e29141a4ad5a43f2b9469dd50c4cb5ab158449fb Mon Sep 17 00:00:00 2001 From: slzhou Date: Mon, 25 Apr 2022 09:30:20 +0800 Subject: [PATCH] udfc open/close in vm init/cleanup --- include/libs/function/function.h | 14 ++++++++++++++ source/dnode/mgmt/mgmt_vnode/src/vmInt.c | 7 ++++++- source/libs/function/inc/tudf.h | 12 ------------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 004d834287..474aba36d4 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -319,6 +319,20 @@ struct SUdfInfo; void qAddUdfInfo(uint64_t id, struct SUdfInfo* pUdfInfo); void qRemoveUdfInfo(uint64_t id, struct SUdfInfo* pUdfInfo); +/** + * create udfd proxy, called once in process that call setupUdf/callUdfxxx/teardownUdf + * @return error code + */ +int32_t udfcOpen(); + +/** + * destroy udfd proxy + * @return error code + */ +int32_t udfcClose(); + +typedef void *UdfcFuncHandle; + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index e784272581..687a799c57 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "vmInt.h" +#include "libs/function/function.h" SVnodeObj *vmAcquireVnode(SVnodesMgmt *pMgmt, int32_t vgId) { SVnodeObj *pVnode = NULL; @@ -275,7 +276,7 @@ static void vmCleanup(SMgmtWrapper *pWrapper) { pWrapper->pMgmt = NULL; // syncCleanUp(); - + udfcClose(); dInfo("vnode-mgmt is cleaned up"); } @@ -339,6 +340,10 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) { } dmReportStartup(pDnode, "vnode-vnodes", "initialized"); + if (udfcOpen() != 0) { + dError("failed to open udfc in dnode"); + } + code = 0; _OVER: diff --git a/source/libs/function/inc/tudf.h b/source/libs/function/inc/tudf.h index 158f79667b..b72905b872 100644 --- a/source/libs/function/inc/tudf.h +++ b/source/libs/function/inc/tudf.h @@ -42,19 +42,7 @@ enum { UDFC_CODE_INVALID_STATE = -5 }; -typedef void *UdfcFuncHandle; -/** - * create udfd proxy, called once in process that call setupUdf/callUdfxxx/teardownUdf - * @return error code - */ -int32_t udfcOpen(); - -/** - * destroy udfd proxy - * @return error code - */ -int32_t udfcClose(); /**