Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bda24a01
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bda24a01
编写于
2月 18, 2023
作者:
H
Haojun Liao
提交者:
GitHub
2月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19992 from taosdata/fix/main
enh: handle too many session
上级
085936e6
a9b6d564
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
552 addition
and
94 deletion
+552
-94
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+6
-1
include/util/taoserror.h
include/util/taoserror.h
+4
-0
include/util/tdef.h
include/util/tdef.h
+3
-3
source/common/src/tglobal.c
source/common/src/tglobal.c
+7
-9
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+10
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+2
-2
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+5
-0
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+4
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+493
-61
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+2
-6
source/libs/transport/test/cliBench.c
source/libs/transport/test/cliBench.c
+14
-10
source/util/src/terror.c
source/util/src/terror.c
+1
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-1
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
bda24a01
...
...
@@ -112,7 +112,12 @@ typedef struct SRpcInit {
// fail fast fp
RpcFFfp
ffp
;
void
*
parent
;
int32_t
connLimitNum
;
int32_t
connLimitLock
;
int8_t
supportBatch
;
// 0: no batch, 1. batch
int32_t
batchSize
;
void
*
parent
;
}
SRpcInit
;
typedef
struct
{
...
...
include/util/taoserror.h
浏览文件 @
bda24a01
...
...
@@ -67,6 +67,10 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) //
#define TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected"
#define TSDB_CODE_RPC_SOMENODE_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) //
#define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x0022) //
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
...
...
include/util/tdef.h
浏览文件 @
bda24a01
...
...
@@ -281,8 +281,8 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_ROLE_MGMT 1
#define TSDB_DNODE_ROLE_VNODE 2
#define TSDB_MAX_REPLICA 5
#define TSDB_SYNC_LOG_BUFFER_SIZE 4096
#define TSDB_MAX_REPLICA
5
#define TSDB_SYNC_LOG_BUFFER_SIZE
4096
#define TSDB_SYNC_LOG_BUFFER_RETENTION (TSDB_SYNC_LOG_BUFFER_SIZE >> 4)
#define TSDB_TBNAME_COLUMN_INDEX (-1)
...
...
@@ -413,7 +413,7 @@ typedef enum ELogicConditionType {
#ifdef WINDOWS
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
#else
#define TSDB_MAX_RPC_THREADS
2
0
#define TSDB_MAX_RPC_THREADS
1
0
#endif
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
...
...
source/common/src/tglobal.c
浏览文件 @
bda24a01
...
...
@@ -76,11 +76,11 @@ bool tsEnableTelem = true;
int32_t
tsTelemInterval
=
43200
;
char
tsTelemServer
[
TSDB_FQDN_LEN
]
=
"telemetry.taosdata.com"
;
uint16_t
tsTelemPort
=
80
;
char
*
tsTelemUri
=
"/report"
;
char
*
tsTelemUri
=
"/report"
;
bool
tsEnableCrashReport
=
true
;
char
*
tsClientCrashReportUri
=
"/ccrashreport"
;
char
*
tsSvrCrashReportUri
=
"/dcrashreport"
;
bool
tsEnableCrashReport
=
true
;
char
*
tsClientCrashReportUri
=
"/ccrashreport"
;
char
*
tsSvrCrashReportUri
=
"/dcrashreport"
;
// schemaless
char
tsSmlTagName
[
TSDB_COL_NAME_LEN
]
=
"_tag_null"
;
...
...
@@ -212,9 +212,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
);
#endif
struct
SConfig
*
taosGetCfg
()
{
return
tsCfg
;
}
struct
SConfig
*
taosGetCfg
()
{
return
tsCfg
;
}
static
int32_t
taosLoadCfg
(
SConfig
*
pCfg
,
const
char
**
envCmd
,
const
char
*
inputCfgDir
,
const
char
*
envFile
,
char
*
apolloUrl
)
{
...
...
@@ -391,7 +389,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"queryRspPolicy"
,
tsQueryRspPolicy
,
0
,
1
,
0
)
!=
0
)
return
-
1
;
tsNumOfRpcThreads
=
tsNumOfCores
/
2
;
tsNumOfRpcThreads
=
TRANGE
(
tsNumOfRpcThreads
,
1
,
TSDB_MAX_RPC_THREADS
);
tsNumOfRpcThreads
=
TRANGE
(
tsNumOfRpcThreads
,
2
,
TSDB_MAX_RPC_THREADS
);
if
(
cfgAddInt32
(
pCfg
,
"numOfRpcThreads"
,
tsNumOfRpcThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfCommitThreads
=
tsNumOfCores
/
2
;
...
...
@@ -501,7 +499,7 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem
=
cfgGetItem
(
tsCfg
,
"numOfRpcThreads"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
tsNumOfRpcThreads
=
numOfCores
/
2
;
tsNumOfRpcThreads
=
TRANGE
(
tsNumOfRpcThreads
,
1
,
4
);
tsNumOfRpcThreads
=
TRANGE
(
tsNumOfRpcThreads
,
2
,
TSDB_MAX_RPC_THREADS
);
pItem
->
i32
=
tsNumOfRpcThreads
;
pItem
->
stype
=
stype
;
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
bda24a01
...
...
@@ -280,10 +280,19 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
retryMaxInterval
=
tsRedirectMaxPeriod
;
rpcInit
.
retryMaxTimouet
=
tsMaxRetryWaitTime
;
rpcInit
.
failFastInterval
=
1
000
;
// interval threshold(ms)
rpcInit
.
failFastInterval
=
5
000
;
// interval threshold(ms)
rpcInit
.
failFastThreshold
=
3
;
// failed threshold
rpcInit
.
ffp
=
dmFailFastFp
;
int32_t
connLimitNum
=
10000
/
(
tsNumOfRpcThreads
*
3
);
connLimitNum
=
TMAX
(
connLimitNum
,
100
);
connLimitNum
=
TMIN
(
connLimitNum
,
500
);
rpcInit
.
connLimitNum
=
connLimitNum
;
rpcInit
.
connLimitLock
=
1
;
rpcInit
.
supportBatch
=
1
;
rpcInit
.
batchSize
=
16
*
1024
;
pTrans
->
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
pTrans
->
clientRpc
==
NULL
)
{
dError
(
"failed to init dnode rpc client"
);
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
bda24a01
...
...
@@ -94,8 +94,8 @@ 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_RETRY_COUNT_LIMIT 100 // retry count limit
//
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT 3000 // connect timeout (ms)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
bda24a01
...
...
@@ -64,6 +64,11 @@ typedef struct {
void
(
*
destroyFp
)(
void
*
ahandle
);
bool
(
*
failFastFp
)(
tmsg_t
msgType
);
int32_t
connLimitNum
;
int8_t
connLimitLock
;
// 0: no lock. 1. lock
int8_t
supportBatch
;
// 0: no batch, 1: support batch
int32_t
batchSize
;
int
index
;
void
*
parent
;
void
*
tcphandle
;
// returned handle from TCP initialization
...
...
source/libs/transport/src/trans.c
浏览文件 @
bda24a01
...
...
@@ -67,6 +67,10 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
startTimer
=
pInit
->
tfp
;
pRpc
->
destroyFp
=
pInit
->
dfp
;
pRpc
->
failFastFp
=
pInit
->
ffp
;
pRpc
->
connLimitNum
=
pInit
->
connLimitNum
;
pRpc
->
connLimitLock
=
pInit
->
connLimitLock
;
pRpc
->
supportBatch
=
pInit
->
supportBatch
;
pRpc
->
batchSize
=
pInit
->
batchSize
;
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
if
(
pRpc
->
numOfThreads
<=
0
)
{
...
...
source/libs/transport/src/transCli.c
浏览文件 @
bda24a01
此差异已折叠。
点击以展开。
source/libs/transport/src/transSvr.c
浏览文件 @
bda24a01
...
...
@@ -12,8 +12,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef USE_UV
#include "transComm.h"
static
TdThreadOnce
transModuleInit
=
PTHREAD_ONCE_INIT
;
...
...
@@ -246,11 +244,11 @@ static bool uvHandleReq(SSvrConn* pConn) {
}
}
else
{
if
(
cost
>=
EXCEPTION_LIMIT_US
)
{
tGWarn
(
"%s conn %p %s received from %s, local info:%s, len:%d,
r
esp:%d, code:%d, cost:%dus, recv exception"
,
tGWarn
(
"%s conn %p %s received from %s, local info:%s, len:%d,
noR
esp:%d, code:%d, cost:%dus, recv exception"
,
transLabel
(
pTransInst
),
pConn
,
TMSG_INFO
(
transMsg
.
msgType
),
pConn
->
dst
,
pConn
->
src
,
msgLen
,
pHead
->
noResp
,
transMsg
.
code
,
(
int
)(
cost
));
}
else
{
tGDebug
(
"%s conn %p %s received from %s, local info:%s, len:%d,
r
esp:%d, code:%d, cost:%dus"
,
tGDebug
(
"%s conn %p %s received from %s, local info:%s, len:%d,
noR
esp:%d, code:%d, cost:%dus"
,
transLabel
(
pTransInst
),
pConn
,
TMSG_INFO
(
transMsg
.
msgType
),
pConn
->
dst
,
pConn
->
src
,
msgLen
,
pHead
->
noResp
,
transMsg
.
code
,
(
int
)(
cost
));
}
...
...
@@ -1347,5 +1345,3 @@ _return2:
}
int
transGetConnInfo
(
void
*
thandle
,
STransHandleInfo
*
pConnInfo
)
{
return
-
1
;
}
#endif
source/libs/transport/test/cliBench.c
浏览文件 @
bda24a01
...
...
@@ -32,22 +32,21 @@ typedef struct {
void
*
pRpc
;
}
SInfo
;
void
initLogEnv
()
{
const
char
*
logDir
=
"/tmp/trans_cli"
;
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
char
*
logDir
=
"/tmp/trans_cli"
;
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
int32_t
maxLogFileNum
=
10000
;
tsAsyncLog
=
0
;
//idxDebugFlag = 143;
//
idxDebugFlag = 143;
strcpy
(
tsLogDir
,
(
char
*
)
logDir
);
taosRemoveDir
(
tsLogDir
);
taosMkDir
(
tsLogDir
);
taosMkDir
(
tsLogDir
);
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
static
void
processResponse
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SInfo
*
pInfo
=
(
SInfo
*
)
pMsg
->
info
.
ahandle
;
tDebug
(
"thread:%d, response is received, type:%d contLen:%d code:0x%x"
,
pInfo
->
index
,
pMsg
->
msgType
,
pMsg
->
contLen
,
...
...
@@ -72,11 +71,12 @@ static void *sendRequest(void *param) {
rpcMsg
.
pCont
=
rpcMallocCont
(
pInfo
->
msgSize
);
rpcMsg
.
contLen
=
pInfo
->
msgSize
;
rpcMsg
.
info
.
ahandle
=
pInfo
;
rpcMsg
.
info
.
noResp
=
1
;
rpcMsg
.
msgType
=
1
;
tDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
,
NULL
);
if
(
pInfo
->
num
%
20000
==
0
)
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
tsem_wait
(
&
pInfo
->
rspSem
);
//
tsem_wait(&pInfo->rspSem);
}
tDebug
(
"thread:%d, it is over"
,
pInfo
->
index
);
...
...
@@ -112,7 +112,12 @@ int main(int argc, char *argv[]) {
rpcInit
.
sessions
=
100
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
user
=
"michael"
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
connLimitNum
=
10
;
rpcInit
.
connLimitLock
=
1
;
rpcInit
.
batchSize
=
16
*
1024
;
rpcInit
.
supportBatch
=
1
;
rpcDebugFlag
=
135
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
...
...
@@ -148,7 +153,6 @@ int main(int argc, char *argv[]) {
exit
(
0
);
}
}
initLogEnv
();
...
...
source/util/src/terror.c
浏览文件 @
bda24a01
...
...
@@ -52,6 +52,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use")
TAOS_DEFINE_ERROR
(
TSDB_CODE_RPC_BROKEN_LINK
,
"Conn is broken"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RPC_TIMEOUT
,
"Conn read timeout"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED
,
"some vnode/qnode/mnode(s) out of service"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_RPC_MAX_SESSIONS
,
"rpc open too many session"
)
//common & util
TAOS_DEFINE_ERROR
(
TSDB_CODE_TIME_UNSYNCED
,
"Client and server's time is not synchronized"
)
...
...
tests/parallel_test/cases.task
浏览文件 @
bda24a01
...
...
@@ -301,7 +301,7 @@
,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim
,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim
,,y,script,./test.sh -f tsim/vnode/replica3_many.sim
,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
#
,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
,,y,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录