Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33143e90
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看板
提交
33143e90
编写于
4月 12, 2023
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance: add udf stub expiration of 10s after creation
上级
218f8d30
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
10 deletion
+10
-10
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+10
-10
未找到文件。
source/libs/function/src/tudf.c
浏览文件 @
33143e90
...
...
@@ -343,7 +343,7 @@ typedef struct SUdfcFuncStub {
char
udfName
[
TSDB_FUNC_NAME_LEN
+
1
];
UdfcFuncHandle
handle
;
int32_t
refCount
;
int64_t
lastRef
Time
;
int64_t
create
Time
;
}
SUdfcFuncStub
;
typedef
struct
SUdfcProxy
{
...
...
@@ -982,15 +982,15 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) {
if
(
stubIndex
!=
-
1
)
{
SUdfcFuncStub
*
foundStub
=
taosArrayGet
(
gUdfcProxy
.
udfStubs
,
stubIndex
);
UdfcFuncHandle
handle
=
foundStub
->
handle
;
if
(
handle
!=
NULL
&&
((
SUdfcUvSession
*
)
handle
)
->
udfUvPipe
!=
NULL
)
{
int64_t
currUs
=
taosGetTimestampUs
();
if
(
handle
!=
NULL
&&
((
SUdfcUvSession
*
)
handle
)
->
udfUvPipe
!=
NULL
&&
(
currUs
-
foundStub
->
createTime
)
<
10
*
1000
*
1000
)
{
*
pHandle
=
foundStub
->
handle
;
++
foundStub
->
refCount
;
foundStub
->
lastRefTime
=
taosGetTimestampUs
();
uv_mutex_unlock
(
&
gUdfcProxy
.
udfStubsMutex
);
return
0
;
}
else
{
fnInfo
(
"invalid handle for %s, refCount: %d,
last ref
time: %"
PRId64
". remove it from cache"
,
udfName
,
foundStub
->
refCount
,
foundStub
->
lastRef
Time
);
fnInfo
(
"invalid handle for %s, refCount: %d,
create
time: %"
PRId64
". remove it from cache"
,
udfName
,
foundStub
->
refCount
,
foundStub
->
create
Time
);
taosArrayRemove
(
gUdfcProxy
.
udfStubs
,
stubIndex
);
}
}
...
...
@@ -1001,7 +1001,7 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) {
strncpy
(
stub
.
udfName
,
udfName
,
TSDB_FUNC_NAME_LEN
);
stub
.
handle
=
*
pHandle
;
++
stub
.
refCount
;
stub
.
lastRef
Time
=
taosGetTimestampUs
();
stub
.
create
Time
=
taosGetTimestampUs
();
taosArrayPush
(
gUdfcProxy
.
udfStubs
,
&
stub
);
taosArraySort
(
gUdfcProxy
.
udfStubs
,
compareUdfcFuncSub
);
}
else
{
...
...
@@ -1046,14 +1046,14 @@ int32_t cleanUpUdfs() {
fnInfo
(
"tear down udf. udf name: %s, handle: %p, ref count: %d"
,
stub
->
udfName
,
stub
->
handle
,
stub
->
refCount
);
doTeardownUdf
(
stub
->
handle
);
}
else
{
fnInfo
(
"udf still in use. udf name: %s, ref count: %d,
last ref
time: %"
PRId64
", handle: %p"
,
stub
->
udfName
,
stub
->
refCount
,
stub
->
lastRef
Time
,
stub
->
handle
);
fnInfo
(
"udf still in use. udf name: %s, ref count: %d,
create
time: %"
PRId64
", handle: %p"
,
stub
->
udfName
,
stub
->
refCount
,
stub
->
create
Time
,
stub
->
handle
);
UdfcFuncHandle
handle
=
stub
->
handle
;
if
(
handle
!=
NULL
&&
((
SUdfcUvSession
*
)
handle
)
->
udfUvPipe
!=
NULL
)
{
taosArrayPush
(
udfStubs
,
stub
);
}
else
{
fnInfo
(
"udf invalid handle for %s, refCount: %d,
last ref
time: %"
PRId64
". remove it from cache"
,
stub
->
udfName
,
stub
->
refCount
,
stub
->
lastRef
Time
);
fnInfo
(
"udf invalid handle for %s, refCount: %d,
create
time: %"
PRId64
". remove it from cache"
,
stub
->
udfName
,
stub
->
refCount
,
stub
->
create
Time
);
}
}
++
i
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录