Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27a20144
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
27a20144
编写于
6月 28, 2023
作者:
D
dapan1121
提交者:
GitHub
6月 28, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21821 from taosdata/fix/ts-3572
fix: udfd can not connect to taosd since authentification failure
上级
f56499e0
fc3fe9df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
56 deletion
+23
-56
include/libs/function/tudf.h
include/libs/function/tudf.h
+6
-0
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+2
-2
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+12
-0
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+0
-54
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+3
-0
未找到文件。
include/libs/function/tudf.h
浏览文件 @
27a20144
...
...
@@ -111,6 +111,12 @@ int32_t udfStartUdfd(int32_t startDnodeId);
*/
int32_t
udfStopUdfd
();
/**
* get udfd pid
*
*/
int32_t
udfGetUdfdPid
(
int32_t
*
pUdfdPid
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
27a20144
...
...
@@ -232,7 +232,6 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
}
code
=
-
1
;
taosIp2String
(
pReq
->
info
.
conn
.
clientIp
,
ip
);
if
(
mndCheckOperPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_CONNECT
)
!=
0
)
{
mGError
(
"user:%s, failed to login from %s since %s"
,
pReq
->
info
.
conn
.
user
,
ip
,
terrstr
());
...
...
@@ -244,7 +243,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
mGError
(
"user:%s, failed to login from %s while acquire user since %s"
,
pReq
->
info
.
conn
.
user
,
ip
,
terrstr
());
goto
_OVER
;
}
if
(
strncmp
(
connReq
.
passwd
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
-
1
)
!=
0
)
{
mGError
(
"user:%s, failed to login from %s since invalid pass, input:%s"
,
pReq
->
info
.
conn
.
user
,
ip
,
connReq
.
passwd
);
code
=
TSDB_CODE_MND_AUTH_FAILURE
;
...
...
@@ -270,6 +269,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
}
}
_CONNECT:
pConn
=
mndCreateConn
(
pMnode
,
pReq
->
info
.
conn
.
user
,
connReq
.
connType
,
pReq
->
info
.
conn
.
clientIp
,
pReq
->
info
.
conn
.
clientPort
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
if
(
pConn
==
NULL
)
{
...
...
source/libs/function/src/tudf.c
浏览文件 @
27a20144
...
...
@@ -255,6 +255,18 @@ int32_t udfStopUdfd() {
return
0
;
}
int32_t
udfGetUdfdPid
(
int32_t
*
pUdfdPid
)
{
SUdfdData
*
pData
=
&
udfdGlobal
;
if
(
pData
->
spawnErr
)
{
return
pData
->
spawnErr
;
}
uv_pid_t
pid
=
uv_process_get_pid
(
&
pData
->
process
);
if
(
pUdfdPid
)
{
*
pUdfdPid
=
(
int32_t
)
pid
;
}
return
TSDB_CODE_SUCCESS
;
}
//==============================================================================================
/* Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
* The QUEUE is copied from queue.h under libuv
...
...
source/libs/function/src/udfd.c
浏览文件 @
27a20144
...
...
@@ -965,40 +965,6 @@ int32_t udfdFillUdfInfoFromMNode(void *clientRpc, char *udfName, SUdf *udf) {
return
code
;
}
int32_t
udfdConnectToMnode
()
{
SConnectReq
connReq
=
{
0
};
connReq
.
connType
=
CONN_TYPE__UDFD
;
tstrncpy
(
connReq
.
app
,
"udfd"
,
sizeof
(
connReq
.
app
));
tstrncpy
(
connReq
.
user
,
TSDB_DEFAULT_USER
,
sizeof
(
connReq
.
user
));
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
TSDB_DEFAULT_PASS
),
strlen
(
TSDB_DEFAULT_PASS
),
pass
);
tstrncpy
(
connReq
.
passwd
,
pass
,
sizeof
(
connReq
.
passwd
));
connReq
.
pid
=
taosGetPId
();
connReq
.
startTime
=
taosGetTimestampMs
();
strcpy
(
connReq
.
sVer
,
version
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSConnectReq
(
pReq
,
contLen
,
&
connReq
);
SUdfdRpcSendRecvInfo
*
msgInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SUdfdRpcSendRecvInfo
));
msgInfo
->
rpcType
=
UDFD_RPC_MNODE_CONNECT
;
uv_sem_init
(
&
msgInfo
->
resultSem
,
0
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
msgType
=
TDMT_MND_CONNECT
;
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
contLen
;
rpcMsg
.
info
.
ahandle
=
msgInfo
;
rpcSendRequest
(
global
.
clientRpc
,
&
global
.
mgmtEp
.
epSet
,
&
rpcMsg
,
NULL
);
uv_sem_wait
(
&
msgInfo
->
resultSem
);
int32_t
code
=
msgInfo
->
code
;
uv_sem_destroy
(
&
msgInfo
->
resultSem
);
taosMemoryFree
(
msgInfo
);
return
code
;
}
static
bool
udfdRpcRfp
(
int32_t
code
,
tmsg_t
msgType
)
{
if
(
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_RPC_BROKEN_LINK
||
code
==
TSDB_CODE_SYN_NOT_LEADER
||
code
==
TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED
||
code
==
TSDB_CODE_SYN_RESTORING
||
...
...
@@ -1378,23 +1344,6 @@ static int32_t udfdRun() {
return
0
;
}
void
udfdConnectMnodeThreadFunc
(
void
*
args
)
{
int32_t
retryMnodeTimes
=
0
;
int32_t
code
=
0
;
while
(
retryMnodeTimes
++
<=
TSDB_MAX_REPLICA
)
{
uv_sleep
(
100
*
(
1
<<
retryMnodeTimes
));
code
=
udfdConnectToMnode
();
if
(
code
==
0
)
{
break
;
}
fnError
(
"udfd can not connect to mnode, code: %s. retry"
,
tstrerror
(
code
));
}
if
(
code
!=
0
)
{
fnError
(
"udfd can not connect to mnode"
);
}
}
int32_t
udfdInitResidentFuncs
()
{
if
(
strlen
(
tsUdfdResFuncs
)
==
0
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1497,9 +1446,6 @@ int main(int argc, char *argv[]) {
udfdInitResidentFuncs
();
uv_thread_t
mnodeConnectThread
;
uv_thread_create
(
&
mnodeConnectThread
,
udfdConnectMnodeThreadFunc
,
NULL
);
udfdRun
();
removeListeningPipe
();
...
...
tests/script/tsim/query/udf.sim
浏览文件 @
27a20144
...
...
@@ -8,6 +8,9 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c udf -v 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql alter user root pass 'taosdata2'
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode1 -s start
print ======== step1 udf
system sh/compile_udf.sh
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录