epset and retrieve so from mnode

This commit is contained in:
slzhou 2022-04-24 10:53:50 +08:00
parent 3bc432a52e
commit 3799c5c62f
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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};