From 3799c5c62f5c03b4ff5655c620b4ad29e9cd7618 Mon Sep 17 00:00:00 2001 From: slzhou Date: Sun, 24 Apr 2022 10:53:50 +0800 Subject: [PATCH] epset and retrieve so from mnode --- source/libs/function/src/udfd.c | 6 +++--- source/libs/function/test/runUdf.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index abd41776b7..ba1413f15d 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -83,8 +83,8 @@ int32_t udfdFillUdfInfoFromMNode(void *clientRpc, SEpSet *pEpSet, char *udfName, int32_t udfdLoadUdf(char *udfName, SEpSet *pEpSet, SUdf *udf) { strcpy(udf->name, udfName); - //udfdFillUdfInfoFromMNode(global.clientRpc, pEpSet, udf->name, udf); - strcpy(udf->path, "/home/slzhou/TDengine/debug/build/lib/libudf1.so"); + udfdFillUdfInfoFromMNode(global.clientRpc, pEpSet, udf->name, udf); + //strcpy(udf->path, "/home/slzhou/TDengine/debug/build/lib/libudf1.so"); int err = uv_dlopen(udf->path, &udf->lib); if (err != 0) { fnError("can not load library %s. error: %s", udf->path, uv_strerror(err)); @@ -417,7 +417,7 @@ int32_t udfdFillUdfInfoFromMNode(void *clientRpc, SEpSet *pEpSet, char *udfName, SFuncInfo *pFuncInfo = (SFuncInfo *)taosArrayGet(retrieveRsp.pFuncInfos, 0); char path[PATH_MAX] = {0}; - taosGetTmpfilePath("/tmp", "libudf", path); + snprintf(path, sizeof(path), "%s/lib%s.so", "/tmp", udfName); TdFilePtr file = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC); // TODO check for failure of flush to disk taosWriteFile(file, pFuncInfo->pCode, pFuncInfo->codeSize); diff --git a/source/libs/function/test/runUdf.c b/source/libs/function/test/runUdf.c index 5085f6250d..80313d251b 100644 --- a/source/libs/function/test/runUdf.c +++ b/source/libs/function/test/runUdf.c @@ -23,6 +23,10 @@ int main(int argc, char *argv[]) { UdfcFuncHandle handle; SEpSet epSet; + epSet.inUse = 0; + taosGetFqdnPortFromEp("localhost:7100", &epSet.eps[0]); + taosGetFqdnPortFromEp("localhost:7200", &epSet.eps[1]); + epSet.numOfEps = 2; setupUdf(udfc, "udf1", &epSet, &handle); SSDataBlock block = {0};