Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27ebbdad
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看板
提交
27ebbdad
编写于
11月 10, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add rpc retry config
上级
11b20e14
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
47 addition
and
17 deletion
+47
-17
include/common/tglobal.h
include/common/tglobal.h
+3
-0
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+8
-6
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+15
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+2
-0
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+5
-5
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+4
-2
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+2
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+4
-3
未找到文件。
include/common/tglobal.h
浏览文件 @
27ebbdad
...
...
@@ -135,6 +135,9 @@ extern int32_t tsTtlPushInterval;
extern
int32_t
tsGrantHBInterval
;
extern
int32_t
tsUptimeInterval
;
extern
int32_t
tsRpcRetryLimit
;
extern
int32_t
tsRpcRetryInterval
;
//#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
...
...
include/libs/transport/trpc.h
浏览文件 @
27ebbdad
...
...
@@ -76,12 +76,14 @@ typedef void (*RpcDfp)(void *ahandle);
typedef
struct
SRpcInit
{
char
localFqdn
[
TSDB_FQDN_LEN
];
uint16_t
localPort
;
// local port
char
*
label
;
// for debug purpose
int32_t
numOfThreads
;
// number of threads to handle connections
int32_t
sessions
;
// number of sessions allowed
int8_t
connType
;
// TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
int32_t
idleTime
;
// milliseconds, 0 means idle timer is disabled
uint16_t
localPort
;
// local port
char
*
label
;
// for debug purpose
int32_t
numOfThreads
;
// number of threads to handle connections
int32_t
sessions
;
// number of sessions allowed
int8_t
connType
;
// TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS
int32_t
idleTime
;
// milliseconds, 0 means idle timer is disabled
int32_t
retryLimit
;
// retry limit
int32_t
retryInterval
;
// retry interval ms
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
...
...
source/client/src/clientEnv.c
浏览文件 @
27ebbdad
...
...
@@ -146,6 +146,8 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
dfp
=
destroyAhandle
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
void
*
pDnodeConn
=
rpcOpen
(
&
rpcInit
);
if
(
pDnodeConn
==
NULL
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
27ebbdad
...
...
@@ -1971,6 +1971,8 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
user
=
"_dnd"
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
clientRpc
==
NULL
)
{
...
...
source/common/src/tglobal.c
浏览文件 @
27ebbdad
...
...
@@ -163,10 +163,12 @@ int32_t tsMqRebalanceInterval = 2;
int32_t
tsTtlUnit
=
86400
;
int32_t
tsTtlPushInterval
=
86400
;
int32_t
tsGrantHBInterval
=
60
;
int32_t
tsUptimeInterval
=
300
;
// seconds
int32_t
tsUptimeInterval
=
300
;
// seconds
char
tsUdfdResFuncs
[
512
]
=
""
;
// udfd resident funcs that teardown when udfd exits
char
tsUdfdLdLibPath
[
512
]
=
""
;
int32_t
tsRpcRetryLimit
=
100
;
int32_t
tsRpcRetryInterval
=
15
;
#ifndef _STORAGE
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
...
...
@@ -297,6 +299,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if
(
cfgAddString
(
pCfg
,
"smlTagName"
,
tsSmlTagName
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"smlDataFormat"
,
tsSmlDataFormat
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxMemUsedByInsert"
,
tsMaxMemUsedByInsert
,
1
,
INT32_MAX
,
true
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryLimit"
,
tsRpcRetryLimit
,
1
,
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryInterval"
,
tsRpcRetryInterval
,
1
,
10000
,
0
)
!=
0
)
return
-
1
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
2
;
tsNumOfTaskQueueThreads
=
TMAX
(
tsNumOfTaskQueueThreads
,
4
);
...
...
@@ -422,6 +426,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddBool
(
pCfg
,
"udf"
,
tsStartUdfd
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"udfdResFuncs"
,
tsUdfdResFuncs
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddString
(
pCfg
,
"udfdLdLibPath"
,
tsUdfdLdLibPath
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryLimit"
,
tsRpcRetryLimit
,
1
,
1000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcRetryInterval"
,
tsRpcRetryInterval
,
1
,
10000
,
0
)
!=
0
)
return
-
1
;
GRANT_CFG_ADD
;
return
0
;
}
...
...
@@ -634,6 +642,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsQueryNodeChunkSize
=
cfgGetItem
(
pCfg
,
"queryNodeChunkSize"
)
->
i32
;
tsQueryUseNodeAllocator
=
cfgGetItem
(
pCfg
,
"queryUseNodeAllocator"
)
->
bval
;
tsKeepColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
tsRpcRetryLimit
=
cfgGetItem
(
pCfg
,
"rpcRetryLimit"
)
->
i32
;
tsRpcRetryInterval
=
cfgGetItem
(
pCfg
,
"rpcRetryInterval"
)
->
i32
;
return
0
;
}
...
...
@@ -708,6 +719,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
tsRpcRetryLimit
=
cfgGetItem
(
pCfg
,
"rpcRetryLimit"
)
->
i32
;
tsRpcRetryInterval
=
cfgGetItem
(
pCfg
,
"rpcRetryInterval"
)
->
i32
;
GRANT_CFG_GET
;
return
0
;
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
27ebbdad
...
...
@@ -258,6 +258,8 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
parent
=
pDnode
;
rpcInit
.
rfp
=
rpcRfp
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
retryLimit
=
tsRpcRetryLimit
;
rpcInit
.
retryInterval
=
tsRpcRetryInterval
;
pTrans
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pTrans
->
clientRpc
==
NULL
)
{
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
27ebbdad
...
...
@@ -94,11 +94,11 @@ typedef void* queue[2];
/* Return the structure holding the given element. */
#define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field))))
#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT
3 // connect timeout (s)
#define TRANS_READ_TIMEOUT
3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT
1024 * 1024 * 512
//
#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
//
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT 3 // connect timeout (s)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
#define TRANS_MAGIC_NUM 0x5f375a86
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
27ebbdad
...
...
@@ -47,8 +47,10 @@ typedef struct {
char
label
[
TSDB_LABEL_LEN
];
char
user
[
TSDB_UNI_LEN
];
// meter ID
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
int32_t
compressSize
;
// -1: no compress, 0 : all data compressed, size: compress data if larger than size
int8_t
encryption
;
// encrypt or not
int32_t
retryLimit
;
// retry limit
int32_t
retryInterval
;
// retry interval ms
void
(
*
cfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
bool
(
*
retry
)(
int32_t
code
,
tmsg_t
msgType
);
...
...
source/libs/transport/src/trans.c
浏览文件 @
27ebbdad
...
...
@@ -48,6 +48,8 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
compressSize
=
pInit
->
compressSize
;
pRpc
->
encryption
=
pInit
->
encryption
;
pRpc
->
retryLimit
=
pInit
->
retryLimit
;
pRpc
->
retryInterval
=
pInit
->
retryInterval
;
// register callback handle
pRpc
->
cfp
=
pInit
->
cfp
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
27ebbdad
...
...
@@ -1288,6 +1288,7 @@ static void doCloseIdleConn(void* param) {
}
static
void
cliSchedMsgToNextNode
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
)
{
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
...
...
@@ -1299,7 +1300,7 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) {
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
arg
->
param1
=
pMsg
;
arg
->
param2
=
pThrd
;
transDQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
TRANS_RETRY_INTERVAL
);
transDQSched
(
pThrd
->
delayQueue
,
doDelayTask
,
arg
,
pTransInst
->
retryInterval
);
}
FORCE_INLINE
void
cliCompareAndSwap
(
int8_t
*
val
,
int8_t
exp
,
int8_t
newVal
)
{
...
...
@@ -1351,7 +1352,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
pMsg
->
sent
=
0
;
pCtx
->
retryCnt
+=
1
;
if
(
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
code
==
TSDB_CODE_RPC_BROKEN_LINK
)
{
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
TRANS_RETRY_COUNT_LIMIT
,
EPSET_GET_SIZE
(
&
pCtx
->
epSet
)
*
3
);
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
pTransInst
->
retryLimit
,
EPSET_GET_SIZE
(
&
pCtx
->
epSet
)
*
3
);
if
(
pCtx
->
retryCnt
<
pCtx
->
retryLimit
)
{
transUnrefCliHandle
(
pConn
);
EPSET_FORWARD_INUSE
(
&
pCtx
->
epSet
);
...
...
@@ -1360,7 +1361,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
return
-
1
;
}
}
else
{
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
TRANS_RETRY_COUNT_LIMIT
,
TRANS_RETRY_COUNT_LIMIT
);
cliCompareAndSwap
(
&
pCtx
->
retryLimit
,
pTransInst
->
retryLimit
,
pTransInst
->
retryLimit
);
if
(
pCtx
->
retryCnt
<
pCtx
->
retryLimit
)
{
if
(
pResp
->
contLen
==
0
)
{
EPSET_FORWARD_INUSE
(
&
pCtx
->
epSet
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录