Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
23d4eef1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
23d4eef1
编写于
3月 30, 2023
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: startup of replace function when no active query
上级
ed48713a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
25 addition
and
3 deletion
+25
-3
include/common/tmsg.h
include/common/tmsg.h
+2
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+19
-0
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+4
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
23d4eef1
...
...
@@ -1054,6 +1054,7 @@ typedef struct {
int64_t
signature
;
char
*
pComment
;
char
*
pCode
;
int8_t
orReplace
;
}
SCreateFuncReq
;
int32_t
tSerializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
);
...
...
@@ -1095,6 +1096,7 @@ typedef struct {
typedef
struct
{
int32_t
numOfFuncs
;
SArray
*
pFuncInfos
;
SArray
*
pFuncVersions
;
}
SRetrieveFuncRsp
;
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
...
...
source/common/src/tmsg.c
浏览文件 @
23d4eef1
...
...
@@ -1702,6 +1702,8 @@ int32_t tSerializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pReq
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
pComment
)
<
0
)
return
-
1
;
}
if
(
tEncodeI8
(
&
encoder
,
pReq
->
orReplace
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -1744,6 +1746,8 @@ int32_t tDeserializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pR
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pComment
)
<
0
)
return
-
1
;
}
if
(
tDecoodeI8
(
&
decoder
,
&
pReq
->
orReplace
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
@@ -1855,6 +1859,12 @@ int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *
}
}
if
(
pRsp
->
numOfFuncs
!=
(
int32_t
)
taosArrayGetSize
(
pRsp
->
pFuncVersions
))
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfFuncs
;
++
i
)
{
int32_t
version
=
*
(
int32_t
*
)
taosArrayGet
(
pRsp
->
pFuncVersions
,
i
);
if
(
tEncodeI32
(
&
encoder
,
version
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -1902,6 +1912,15 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
taosArrayPush
(
pRsp
->
pFuncInfos
,
&
fInfo
);
}
pRsp
->
pFuncVersions
=
taosArrayInit
(
pRsp
->
numOfFuncs
,
sizeof
(
int32_t
));
if
(
pRsp
->
pFuncVersions
==
NULL
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfFuncs
;
++
i
)
{
int32_t
version
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
version
)
<
0
)
return
-
1
;
taosArrayPush
(
pRsp
->
pFuncVersions
,
&
version
);
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/libs/function/src/udfd.c
浏览文件 @
23d4eef1
...
...
@@ -246,6 +246,7 @@ typedef enum { UDF_STATE_INIT = 0, UDF_STATE_LOADING, UDF_STATE_READY } EUdfStat
typedef
struct
SUdf
{
char
name
[
TSDB_FUNC_NAME_LEN
+
1
];
int32_t
version
;
int8_t
funcType
;
int8_t
scriptType
;
...
...
@@ -833,13 +834,13 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
goto
_return
;
}
SFuncInfo
*
pFuncInfo
=
(
SFuncInfo
*
)
taosArrayGet
(
retrieveRsp
.
pFuncInfos
,
0
);
// SUdf *udf = msgInfo->param;
SUdf
*
udf
=
msgInfo
->
param
;
udf
->
funcType
=
pFuncInfo
->
funcType
;
udf
->
scriptType
=
pFuncInfo
->
scriptType
;
udf
->
outputType
=
pFuncInfo
->
outputType
;
udf
->
outputLen
=
pFuncInfo
->
outputLen
;
udf
->
bufSize
=
pFuncInfo
->
bufSize
;
udf
->
version
=
*
(
int32_t
*
)
taosArrayGet
(
retrieveRsp
.
pFuncVersions
,
0
);
if
(
!
osTempSpaceAvailable
())
{
terrno
=
TSDB_CODE_NO_AVAIL_DISK
;
...
...
@@ -850,9 +851,9 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
char
path
[
PATH_MAX
]
=
{
0
};
#ifdef WINDOWS
snprintf
(
path
,
sizeof
(
path
),
"%s%s
"
,
tsTempDir
,
pFuncInfo
->
name
);
snprintf
(
path
,
sizeof
(
path
),
"%s%s
%d"
,
tsTempDir
,
pFuncInfo
->
name
,
udf
->
version
);
#else
snprintf
(
path
,
sizeof
(
path
),
"%s/%s
"
,
tsTempDir
,
pFuncInfo
->
name
);
snprintf
(
path
,
sizeof
(
path
),
"%s/%s
%d"
,
tsTempDir
,
pFuncInfo
->
name
,
udf
->
version
);
#endif
TdFilePtr
file
=
taosOpenFile
(
path
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_READ
|
TD_FILE_TRUNC
);
if
(
file
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录