Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7c57b03d
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看板
提交
7c57b03d
编写于
6月 25, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
handle rpc retry
上级
1b339c9c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
29 deletion
+46
-29
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+12
-5
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+21
-19
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+10
-3
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+2
-1
未找到文件。
source/client/src/clientEnv.c
浏览文件 @
7c57b03d
...
...
@@ -86,7 +86,7 @@ void closeTransporter(STscObj *pTscObj) {
static
bool
clientRpcRfp
(
int32_t
code
)
{
if
(
code
==
TSDB_CODE_RPC_REDIRECT
||
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_NODE_NOT_DEPLOYED
||
code
==
TSDB_CODE_SYN_NOT_LEADER
)
{
code
==
TSDB_CODE_SYN_NOT_LEADER
||
code
==
TSDB_CODE_APP_NOT_READY
)
{
return
true
;
}
else
{
return
false
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
7c57b03d
...
...
@@ -70,9 +70,9 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
}
static
void
dmProcessRpcMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
int32_t
code
=
-
1
;
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
SMgmtWrapper
*
pWrapper
=
NULL
;
SDnodeHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
pRpc
->
msgType
)];
...
...
@@ -194,11 +194,11 @@ int32_t dmInitMsgHandle(SDnode *pDnode) {
for
(
EDndNodeType
ntype
=
DNODE
;
ntype
<
NODE_END
;
++
ntype
)
{
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
ntype
];
SArray
*
pArray
=
(
*
pWrapper
->
func
.
getHandlesFp
)();
SArray
*
pArray
=
(
*
pWrapper
->
func
.
getHandlesFp
)();
if
(
pArray
==
NULL
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
++
i
)
{
SMgmtHandle
*
pMgmt
=
taosArrayGet
(
pArray
,
i
);
SMgmtHandle
*
pMgmt
=
taosArrayGet
(
pArray
,
i
);
SDnodeHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
pMgmt
->
msgType
)];
if
(
pMgmt
->
needCheckVgId
)
{
pHandle
->
needCheckVgId
=
pMgmt
->
needCheckVgId
;
...
...
@@ -248,7 +248,14 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) {
}
}
static
bool
rpcRfp
(
int32_t
code
)
{
return
code
==
TSDB_CODE_RPC_REDIRECT
;
}
static
bool
rpcRfp
(
int32_t
code
)
{
if
(
code
==
TSDB_CODE_RPC_REDIRECT
||
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_NODE_NOT_DEPLOYED
||
code
==
TSDB_CODE_SYN_NOT_LEADER
||
code
==
TSDB_CODE_APP_NOT_READY
)
{
return
true
;
}
else
{
return
false
;
}
}
int32_t
dmInitClient
(
SDnode
*
pDnode
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
...
...
source/libs/function/src/udfd.c
浏览文件 @
7c57b03d
...
...
@@ -12,6 +12,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// clang-format off
#include "uv.h"
#include "os.h"
#include "fnLog.h"
...
...
@@ -25,6 +27,7 @@
#include "tglobal.h"
#include "tmsg.h"
#include "trpc.h"
// clang-foramt on
typedef
struct
SUdfdContext
{
uv_loop_t
*
loop
;
...
...
@@ -103,12 +106,12 @@ typedef struct SUdfdRpcSendRecvInfo {
uv_sem_t
resultSem
;
}
SUdfdRpcSendRecvInfo
;
static
void
udfdProcessRpcRsp
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
void
udfdProcessRpcRsp
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
int32_t
udfdFillUdfInfoFromMNode
(
void
*
clientRpc
,
char
*
udfName
,
SUdf
*
udf
);
static
int32_t
udfdConnectToMnode
();
static
int32_t
udfdLoadUdf
(
char
*
udfName
,
SUdf
*
udf
);
static
bool
udfdRpcRfp
(
int32_t
code
);
static
int
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
bool
udfdRpcRfp
(
int32_t
code
);
static
int
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
udfdOpenClientRpc
();
static
int32_t
udfdCloseClientRpc
();
...
...
@@ -126,19 +129,19 @@ static void udfdUvHandleError(SUdfdUvConn *conn) { uv_close((uv_handle_t *)conn-
static
void
udfdPipeRead
(
uv_stream_t
*
client
,
ssize_t
nread
,
const
uv_buf_t
*
buf
);
static
void
udfdOnNewConnection
(
uv_stream_t
*
server
,
int
status
);
static
void
udfdIntrSignalHandler
(
uv_signal_t
*
handle
,
int
signum
);
static
void
udfdIntrSignalHandler
(
uv_signal_t
*
handle
,
int
signum
);
static
int32_t
removeListeningPipe
();
static
void
udfdPrintVersion
();
static
void
udfdPrintVersion
();
static
int32_t
udfdParseArgs
(
int32_t
argc
,
char
*
argv
[]);
static
int32_t
udfdInitLog
();
static
void
udfdCtrlAllocBufCb
(
uv_handle_t
*
handle
,
size_t
suggested_size
,
uv_buf_t
*
buf
);
static
void
udfdCtrlReadCb
(
uv_stream_t
*
q
,
ssize_t
nread
,
const
uv_buf_t
*
buf
);
static
void
udfdCtrlAllocBufCb
(
uv_handle_t
*
handle
,
size_t
suggested_size
,
uv_buf_t
*
buf
);
static
void
udfdCtrlReadCb
(
uv_stream_t
*
q
,
ssize_t
nread
,
const
uv_buf_t
*
buf
);
static
int32_t
udfdUvInit
();
static
void
udfdCloseWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
);
static
void
udfdCloseWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
);
static
int32_t
udfdRun
();
static
void
udfdConnectMnodeThreadFunc
(
void
*
args
);
static
void
udfdConnectMnodeThreadFunc
(
void
*
args
);
void
udfdProcessRequest
(
uv_work_t
*
req
)
{
SUvUdfWork
*
uvUdf
=
(
SUvUdfWork
*
)(
req
->
data
);
...
...
@@ -401,11 +404,11 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
udf
->
bufSize
=
pFuncInfo
->
bufSize
;
char
path
[
PATH_MAX
]
=
{
0
};
#ifdef WINDOWS
#ifdef WINDOWS
snprintf
(
path
,
sizeof
(
path
),
"%s%s.dll"
,
TD_TMP_DIR_PATH
,
pFuncInfo
->
name
);
#else
#else
snprintf
(
path
,
sizeof
(
path
),
"%s/lib%s.so"
,
TD_TMP_DIR_PATH
,
pFuncInfo
->
name
);
#endif
#endif
TdFilePtr
file
=
taosOpenFile
(
path
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_READ
|
TD_FILE_TRUNC
|
TD_FILE_AUTO_DEL
);
if
(
file
==
NULL
)
{
...
...
@@ -544,7 +547,8 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) {
return
0
;
}
static
bool
udfdRpcRfp
(
int32_t
code
)
{
if
(
code
==
TSDB_CODE_RPC_REDIRECT
)
{
if
(
code
==
TSDB_CODE_RPC_REDIRECT
||
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_NODE_NOT_DEPLOYED
||
code
==
TSDB_CODE_SYN_NOT_LEADER
||
code
==
TSDB_CODE_APP_NOT_READY
)
{
return
true
;
}
else
{
return
false
;
...
...
@@ -652,8 +656,7 @@ void udfdAllocBuffer(uv_handle_t *handle, size_t suggestedSize, uv_buf_t *buf) {
buf
->
base
=
ctx
->
inputBuf
;
buf
->
len
=
ctx
->
inputCap
;
}
else
{
fnError
(
"udfd can not allocate enough memory"
)
buf
->
base
=
NULL
;
fnError
(
"udfd can not allocate enough memory"
)
buf
->
base
=
NULL
;
buf
->
len
=
0
;
}
}
else
{
...
...
@@ -664,8 +667,7 @@ void udfdAllocBuffer(uv_handle_t *handle, size_t suggestedSize, uv_buf_t *buf) {
buf
->
base
=
ctx
->
inputBuf
+
ctx
->
inputLen
;
buf
->
len
=
ctx
->
inputCap
-
ctx
->
inputLen
;
}
else
{
fnError
(
"udfd can not allocate enough memory"
)
buf
->
base
=
NULL
;
fnError
(
"udfd can not allocate enough memory"
)
buf
->
base
=
NULL
;
buf
->
len
=
0
;
}
}
...
...
@@ -881,7 +883,7 @@ static int32_t udfdRun() {
return
0
;
}
void
udfdConnectMnodeThreadFunc
(
void
*
args
)
{
void
udfdConnectMnodeThreadFunc
(
void
*
args
)
{
int32_t
retryMnodeTimes
=
0
;
int32_t
code
=
0
;
while
(
retryMnodeTimes
++
<=
TSDB_MAX_REPLICA
)
{
...
...
@@ -939,7 +941,7 @@ int main(int argc, char *argv[]) {
uv_thread_create
(
&
mnodeConnectThread
,
udfdConnectMnodeThreadFunc
,
NULL
);
udfdRun
();
removeListeningPipe
();
udfdCloseClientRpc
();
...
...
source/libs/transport/src/transCli.c
浏览文件 @
7c57b03d
...
...
@@ -758,13 +758,16 @@ static void cliHandleUpdate(SCliMsg* pMsg, SCliThrd* pThrd) {
destroyCmsg
(
pMsg
);
}
SCliConn
*
cliGetConn
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
)
{
SCliConn
*
cliGetConn
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
,
bool
*
ignore
)
{
SCliConn
*
conn
=
NULL
;
int64_t
refId
=
(
int64_t
)(
pMsg
->
msg
.
info
.
handle
);
if
(
refId
!=
0
)
{
SExHandle
*
exh
=
transAcquireExHandle
(
refMgt
,
refId
);
if
(
exh
==
NULL
)
{
assert
(
0
);
*
ignore
=
true
;
destroyCmsg
(
pMsg
);
return
NULL
;
// assert(0);
}
else
{
conn
=
exh
->
handle
;
transReleaseExHandle
(
refMgt
,
refId
);
...
...
@@ -799,7 +802,11 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
cliMayCvtFqdnToIp
(
&
pCtx
->
epSet
,
&
pThrd
->
cvtAddr
);
// transPrintEpSet(&pCtx->epSet);
SCliConn
*
conn
=
cliGetConn
(
pMsg
,
pThrd
);
bool
ignore
=
false
;
SCliConn
*
conn
=
cliGetConn
(
pMsg
,
pThrd
,
&
ignore
);
if
(
ignore
==
true
)
{
return
;
}
if
(
conn
!=
NULL
)
{
transCtxMerge
(
&
conn
->
ctx
,
&
pCtx
->
appCtx
);
transQueuePush
(
&
conn
->
cliMsgs
,
pMsg
);
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
7c57b03d
...
...
@@ -422,7 +422,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
transUnrefSrvHandle
(
pConn
);
}
else
{
pHead
->
msgType
=
pMsg
->
msgType
;
if
(
pHead
->
msgType
==
0
)
pHead
->
msgType
=
pConn
->
inType
+
1
;
if
(
pHead
->
msgType
==
0
&&
transMsgLenFromCont
(
pMsg
->
contLen
)
==
sizeof
(
STransMsgHead
))
pHead
->
msgType
=
pConn
->
inType
+
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录