Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f22d0731
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看板
提交
f22d0731
编写于
2月 15, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
handle too many session
上级
b8dfc714
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
13 deletion
+32
-13
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+2
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+2
-1
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+3
-1
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+2
-1
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+23
-9
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
f22d0731
...
@@ -112,7 +112,8 @@ typedef struct SRpcInit {
...
@@ -112,7 +112,8 @@ typedef struct SRpcInit {
// fail fast fp
// fail fast fp
RpcFFfp
ffp
;
RpcFFfp
ffp
;
int32_t
connLimit
;
int32_t
connLimitNum
;
int32_t
connLimitLock
;
void
*
parent
;
void
*
parent
;
}
SRpcInit
;
}
SRpcInit
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
f22d0731
...
@@ -284,7 +284,8 @@ int32_t dmInitClient(SDnode *pDnode) {
...
@@ -284,7 +284,8 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
failFastThreshold
=
3
;
// failed threshold
rpcInit
.
failFastThreshold
=
3
;
// failed threshold
rpcInit
.
ffp
=
dmFailFastFp
;
rpcInit
.
ffp
=
dmFailFastFp
;
rpcInit
.
connLimit
=
3000
;
rpcInit
.
connLimitNum
=
3000
;
rpcInit
.
connLimitLock
=
1
;
pTrans
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
pTrans
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pTrans
->
clientRpc
==
NULL
)
{
if
(
pTrans
->
clientRpc
==
NULL
)
{
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
f22d0731
...
@@ -64,7 +64,9 @@ typedef struct {
...
@@ -64,7 +64,9 @@ typedef struct {
void
(
*
destroyFp
)(
void
*
ahandle
);
void
(
*
destroyFp
)(
void
*
ahandle
);
bool
(
*
failFastFp
)(
tmsg_t
msgType
);
bool
(
*
failFastFp
)(
tmsg_t
msgType
);
int32_t
connLimit
;
int32_t
connLimitNum
;
int8_t
connLimitLock
;
// 0: no lock. 1. lock
int
index
;
int
index
;
void
*
parent
;
void
*
parent
;
void
*
tcphandle
;
// returned handle from TCP initialization
void
*
tcphandle
;
// returned handle from TCP initialization
...
...
source/libs/transport/src/trans.c
浏览文件 @
f22d0731
...
@@ -67,7 +67,8 @@ void* rpcOpen(const SRpcInit* pInit) {
...
@@ -67,7 +67,8 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
startTimer
=
pInit
->
tfp
;
pRpc
->
startTimer
=
pInit
->
tfp
;
pRpc
->
destroyFp
=
pInit
->
dfp
;
pRpc
->
destroyFp
=
pInit
->
dfp
;
pRpc
->
failFastFp
=
pInit
->
ffp
;
pRpc
->
failFastFp
=
pInit
->
ffp
;
pRpc
->
connLimit
=
pInit
->
connLimit
;
pRpc
->
connLimitNum
=
pInit
->
connLimitNum
;
pRpc
->
connLimitLock
=
pInit
->
connLimitLock
;
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
if
(
pRpc
->
numOfThreads
<=
0
)
{
if
(
pRpc
->
numOfThreads
<=
0
)
{
...
...
source/libs/transport/src/transCli.c
浏览文件 @
f22d0731
...
@@ -85,7 +85,7 @@ typedef struct SCliThrd {
...
@@ -85,7 +85,7 @@ typedef struct SCliThrd {
SCvtAddr
cvtAddr
;
SCvtAddr
cvtAddr
;
SHashObj
*
failFastCache
;
SHashObj
*
failFastCache
;
SHashObj
*
connLimit
;
SHashObj
*
connLimit
Cache
;
SCliMsg
*
stopMsg
;
SCliMsg
*
stopMsg
;
...
@@ -750,9 +750,9 @@ static void cliDestroy(uv_handle_t* handle) {
...
@@ -750,9 +750,9 @@ static void cliDestroy(uv_handle_t* handle) {
transReqQueueClear
(
&
conn
->
wreqQueue
);
transReqQueueClear
(
&
conn
->
wreqQueue
);
transDestroyBuffer
(
&
conn
->
readBuf
);
transDestroyBuffer
(
&
conn
->
readBuf
);
int32_t
*
oVal
=
taosHashGet
(
pThrd
->
connLimit
,
conn
->
ip
,
strlen
(
conn
->
ip
));
int32_t
*
oVal
=
taosHashGet
(
pThrd
->
connLimit
Cache
,
conn
->
ip
,
strlen
(
conn
->
ip
));
int32_t
nVal
=
oVal
==
NULL
?
0
:
(
*
oVal
)
-
1
;
int32_t
nVal
=
oVal
==
NULL
?
0
:
(
*
oVal
)
-
1
;
taosHashPut
(
pThrd
->
connLimit
,
conn
->
ip
,
strlen
(
conn
->
ip
),
&
nVal
,
sizeof
(
nVal
));
taosHashPut
(
pThrd
->
connLimit
Cache
,
conn
->
ip
,
strlen
(
conn
->
ip
),
&
nVal
,
sizeof
(
nVal
));
taosMemoryFree
(
conn
);
taosMemoryFree
(
conn
);
}
}
...
@@ -930,9 +930,9 @@ void cliConnCb(uv_connect_t* req, int status) {
...
@@ -930,9 +930,9 @@ void cliConnCb(uv_connect_t* req, int status) {
return
;
return
;
}
}
int32_t
*
oVal
=
taosHashGet
(
pThrd
->
connLimit
,
pConn
->
ip
,
strlen
(
pConn
->
ip
));
int32_t
*
oVal
=
taosHashGet
(
pThrd
->
connLimit
Cache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
));
int32_t
nVal
=
oVal
==
NULL
?
0
:
(
*
oVal
)
+
1
;
int32_t
nVal
=
oVal
==
NULL
?
0
:
(
*
oVal
)
+
1
;
taosHashPut
(
pThrd
->
connLimit
,
pConn
->
ip
,
strlen
(
pConn
->
ip
),
&
nVal
,
sizeof
(
nVal
));
taosHashPut
(
pThrd
->
connLimit
Cache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
),
&
nVal
,
sizeof
(
nVal
));
struct
sockaddr
peername
,
sockname
;
struct
sockaddr
peername
,
sockname
;
int
addrlen
=
sizeof
(
peername
);
int
addrlen
=
sizeof
(
peername
);
...
@@ -1080,10 +1080,10 @@ static int32_t cliPreCheckSessionLimit(SCliThrd* pThrd, SCliMsg* pMsg) {
...
@@ -1080,10 +1080,10 @@ static int32_t cliPreCheckSessionLimit(SCliThrd* pThrd, SCliMsg* pMsg) {
char
key
[
TSDB_FQDN_LEN
+
64
]
=
{
0
};
char
key
[
TSDB_FQDN_LEN
+
64
]
=
{
0
};
CONN_CONSTRUCT_HASH_KEY
(
key
,
ip
,
port
);
CONN_CONSTRUCT_HASH_KEY
(
key
,
ip
,
port
);
int32_t
*
val
=
taosHashGet
(
pThrd
->
connLimit
,
key
,
strlen
(
key
));
int32_t
*
val
=
taosHashGet
(
pThrd
->
connLimit
Cache
,
key
,
strlen
(
key
));
if
(
val
==
NULL
)
return
0
;
if
(
val
==
NULL
)
return
0
;
if
(
*
val
>=
pTransInst
->
connLimit
)
{
if
(
*
val
>=
pTransInst
->
connLimit
Num
)
{
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
...
@@ -1441,7 +1441,8 @@ static SCliThrd* createThrdObj(void* trans) {
...
@@ -1441,7 +1441,8 @@ static SCliThrd* createThrdObj(void* trans) {
pThrd
->
destroyAhandleFp
=
pTransInst
->
destroyFp
;
pThrd
->
destroyAhandleFp
=
pTransInst
->
destroyFp
;
pThrd
->
fqdn2ipCache
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
pThrd
->
fqdn2ipCache
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
pThrd
->
failFastCache
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
pThrd
->
failFastCache
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
pThrd
->
connLimit
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
pThrd
->
connLimitCache
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
pTransInst
->
connLimitLock
==
0
?
HASH_NO_LOCK
:
HASH_ENTRY_LOCK
);
pThrd
->
quit
=
false
;
pThrd
->
quit
=
false
;
return
pThrd
;
return
pThrd
;
...
@@ -1470,7 +1471,7 @@ static void destroyThrdObj(SCliThrd* pThrd) {
...
@@ -1470,7 +1471,7 @@ static void destroyThrdObj(SCliThrd* pThrd) {
taosMemoryFree
(
pThrd
->
loop
);
taosMemoryFree
(
pThrd
->
loop
);
taosHashCleanup
(
pThrd
->
fqdn2ipCache
);
taosHashCleanup
(
pThrd
->
fqdn2ipCache
);
taosHashCleanup
(
pThrd
->
failFastCache
);
taosHashCleanup
(
pThrd
->
failFastCache
);
taosHashCleanup
(
pThrd
->
connLimit
);
taosHashCleanup
(
pThrd
->
connLimit
Cache
);
taosMemoryFree
(
pThrd
);
taosMemoryFree
(
pThrd
);
}
}
...
@@ -1894,6 +1895,19 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
...
@@ -1894,6 +1895,19 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
return
TSDB_CODE_RPC_BROKEN_LINK
;
return
TSDB_CODE_RPC_BROKEN_LINK
;
}
}
if
(
pTransInst
->
connLimitNum
>
0
&&
REQUEST_NO_RESP
(
pReq
))
{
char
key
[
TSDB_FQDN_LEN
+
64
]
=
{
0
};
char
*
ip
=
EPSET_GET_INUSE_IP
((
SEpSet
*
)
pEpSet
);
uint16_t
port
=
EPSET_GET_INUSE_PORT
((
SEpSet
*
)
pEpSet
);
CONN_CONSTRUCT_HASH_KEY
(
key
,
ip
,
port
);
int32_t
*
val
=
taosHashGet
(
pThrd
->
connLimitCache
,
key
,
strlen
(
key
));
if
(
val
!=
NULL
&&
*
val
>=
pTransInst
->
connLimitNum
)
{
transFreeMsg
(
pReq
->
pCont
);
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
return
TSDB_CODE_RPC_BROKEN_LINK
;
}
}
TRACE_SET_MSGID
(
&
pReq
->
info
.
traceId
,
tGenIdPI64
());
TRACE_SET_MSGID
(
&
pReq
->
info
.
traceId
,
tGenIdPI64
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录