Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d28ee044
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d28ee044
编写于
9月 16, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue #514
上级
23f07aa1
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
37 addition
and
15 deletion
+37
-15
src/inc/trpc.h
src/inc/trpc.h
+2
-1
src/rpc/src/trpc.c
src/rpc/src/trpc.c
+13
-6
src/system/inc/vnode.h
src/system/inc/vnode.h
+2
-1
src/system/src/mgmtSystem.c
src/system/src/mgmtSystem.c
+0
-1
src/system/src/vnodeFile.c
src/system/src/vnodeFile.c
+9
-0
src/system/src/vnodeShell.c
src/system/src/vnodeShell.c
+3
-2
src/system/src/vnodeSystem.c
src/system/src/vnodeSystem.c
+8
-4
未找到文件。
src/inc/trpc.h
浏览文件 @
d28ee044
...
...
@@ -35,6 +35,7 @@ extern "C" {
#define TAOS_ID_REALLOCATE 2
#define taosSendMsgToPeer(x, y, z) taosSendMsgToPeerH(x, y, z, NULL)
#define taosOpenRpcChann(x, y, z) taosOpenRpcChannWithQ(x, y, z, NULL)
#define taosBuildReqMsg(x, y) taosBuildReqMsgWithSize(x, y, 512)
#define taosBuildRspMsg(x, y) taosBuildRspMsgWithSize(x, y, 512)
...
...
@@ -79,7 +80,7 @@ void *taosOpenRpc(SRpcInit *pRpc);
void
taosCloseRpc
(
void
*
);
int
taosOpenRpcChann
(
void
*
handle
,
int
cid
,
int
sessions
);
int
taosOpenRpcChann
WithQ
(
void
*
handle
,
int
cid
,
int
sessions
,
void
*
qhandle
);
void
taosCloseRpcChann
(
void
*
handle
,
int
cid
);
...
...
src/rpc/src/trpc.c
浏览文件 @
d28ee044
...
...
@@ -87,6 +87,7 @@ typedef struct {
typedef
struct
{
int
sessions
;
void
*
qhandle
;
// for scheduler
SRpcConn
*
connList
;
void
*
idPool
;
void
*
tmrCtrl
;
...
...
@@ -340,7 +341,7 @@ void *taosOpenRpc(SRpcInit *pRpc) {
return
pServer
;
}
int
taosOpenRpcChann
(
void
*
handle
,
int
cid
,
int
sessions
)
{
int
taosOpenRpcChann
WithQ
(
void
*
handle
,
int
cid
,
int
sessions
,
void
*
qhandle
)
{
STaosRpc
*
pServer
=
(
STaosRpc
*
)
handle
;
SRpcChann
*
pChann
;
...
...
@@ -384,6 +385,8 @@ int taosOpenRpcChann(void *handle, int cid, int sessions) {
pthread_mutex_init
(
&
pChann
->
mutex
,
NULL
);
pChann
->
sessions
=
sessions
;
pChann
->
qhandle
=
qhandle
?
qhandle
:
pServer
->
qhandle
;
return
0
;
}
...
...
@@ -986,7 +989,7 @@ void taosProcessIdleTimer(void *param, void *tmrId) {
schedMsg
.
msg
=
NULL
;
schedMsg
.
ahandle
=
pConn
->
ahandle
;
schedMsg
.
thandle
=
pConn
;
taosScheduleTask
(
p
Server
->
qhandle
,
&
schedMsg
);
taosScheduleTask
(
p
Chann
->
qhandle
,
&
schedMsg
);
}
pthread_mutex_unlock
(
&
pChann
->
mutex
);
...
...
@@ -1002,12 +1005,14 @@ void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port,
char
pReply
[
128
];
SSchedMsg
schedMsg
;
int
chann
,
sid
;
SRpcChann
*
pChann
=
NULL
;
tDump
(
data
,
dataLen
);
if
(
ip
==
0
&&
taosCloseConn
[
pServer
->
type
])
{
// it means the connection is broken
if
(
pConn
)
{
pChann
=
pServer
->
channList
+
pConn
->
chann
;
tTrace
(
"%s cid:%d sid:%d id:%s, underlying link is gone pConn:%p"
,
pServer
->
label
,
pConn
->
chann
,
pConn
->
sid
,
pConn
->
meterId
,
pConn
);
pConn
->
rspReceived
=
1
;
...
...
@@ -1016,7 +1021,7 @@ void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port,
schedMsg
.
msg
=
NULL
;
schedMsg
.
ahandle
=
pConn
->
ahandle
;
schedMsg
.
thandle
=
pConn
;
taosScheduleTask
(
p
Server
->
qhandle
,
&
schedMsg
);
taosScheduleTask
(
p
Chann
->
qhandle
,
&
schedMsg
);
}
tfree
(
data
);
return
NULL
;
...
...
@@ -1070,6 +1075,7 @@ void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port,
// internal communication is based on TAOS protocol, a trick here to make it efficient
pHeader
->
msgLen
=
msgLen
-
(
int
)
sizeof
(
STaosHeader
)
+
(
int
)
sizeof
(
SIntMsg
);
if
(
pHeader
->
spi
)
pHeader
->
msgLen
-=
sizeof
(
STaosDigest
);
if
((
pHeader
->
msgType
&
1
)
==
0
&&
(
pHeader
->
content
[
0
]
==
TSDB_CODE_SESSION_ALREADY_EXIST
))
{
schedMsg
.
msg
=
NULL
;
// connection shall be closed
...
...
@@ -1084,10 +1090,11 @@ void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port,
pConn
->
pTimer
);
}
pChann
=
pServer
->
channList
+
pConn
->
chann
;
schedMsg
.
fp
=
taosProcessSchedMsg
;
schedMsg
.
ahandle
=
pConn
->
ahandle
;
schedMsg
.
thandle
=
pConn
;
taosScheduleTask
(
p
Server
->
qhandle
,
&
schedMsg
);
taosScheduleTask
(
p
Chann
->
qhandle
,
&
schedMsg
);
}
return
pConn
;
...
...
@@ -1274,7 +1281,7 @@ void taosProcessTaosTimer(void *param, void *tmrId) {
schedMsg
.
msg
=
NULL
;
schedMsg
.
ahandle
=
pConn
->
ahandle
;
schedMsg
.
thandle
=
pConn
;
taosScheduleTask
(
p
Server
->
qhandle
,
&
schedMsg
);
taosScheduleTask
(
p
Chann
->
qhandle
,
&
schedMsg
);
}
}
}
...
...
@@ -1342,7 +1349,7 @@ void taosStopRpcConn(void *thandle) {
schedMsg
.
thandle
=
pConn
;
pthread_mutex_unlock
(
&
pChann
->
mutex
);
taosScheduleTask
(
p
Server
->
qhandle
,
&
schedMsg
);
taosScheduleTask
(
p
Chann
->
qhandle
,
&
schedMsg
);
}
else
{
pthread_mutex_unlock
(
&
pChann
->
mutex
);
taosCloseRpcConn
(
pConn
);
...
...
src/system/inc/vnode.h
浏览文件 @
d28ee044
...
...
@@ -324,11 +324,12 @@ typedef struct {
// internal globals
extern
int
tsMeterSizeOnFile
;
extern
uint32_t
tsRebootTime
;
extern
void
*
rpcQhandle
;
extern
void
*
*
rpcQhandle
;
extern
void
*
dmQhandle
;
extern
void
*
queryQhandle
;
extern
int
tsMaxVnode
;
extern
int
tsOpenVnodes
;
extern
int
tsMaxVnode
;
extern
SVnodeObj
*
vnodeList
;
extern
void
*
vnodeTmrCtrl
;
...
...
src/system/src/mgmtSystem.c
浏览文件 @
d28ee044
...
...
@@ -39,7 +39,6 @@ void * mgmtStatisticTimer = NULL;
void
*
mgmtStatusTimer
=
NULL
;
int
mgmtShellConns
=
0
;
extern
void
*
pShellConn
;
extern
void
*
rpcQhandle
;
void
mgmtCleanUpSystem
()
{
mTrace
(
"mgmt is running, clean it up"
);
...
...
src/system/src/vnodeFile.c
浏览文件 @
d28ee044
...
...
@@ -1863,11 +1863,20 @@ int vnodeCheckNewHeaderFile(int fd, SVnodeObj *pVnode) {
}
if
(
read
(
fd
,
(
void
*
)
pBlocks
,
expectedSize
)
!=
expectedSize
)
{
dError
(
"failed to read block part"
);
goto
_broken_exit
;
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pBlocks
,
expectedSize
))
{
dError
(
"block part is broken"
);
goto
_broken_exit
;
}
for
(
int
i
=
0
;
i
<
compInfo
.
numOfBlocks
;
i
++
)
{
if
(
pBlocks
[
i
].
last
&&
i
!=
compInfo
.
numOfBlocks
-
1
)
{
dError
(
"last block in middle, block:%d"
,
i
);
goto
_broken_exit
;
}
}
}
_correct_exit:
...
...
src/system/src/vnodeShell.c
浏览文件 @
d28ee044
...
...
@@ -31,6 +31,7 @@
#include "vnodeUtil.h"
#pragma GCC diagnostic ignored "-Wint-conversion"
extern
int
tsMaxQueues
;
void
*
pShellServer
=
NULL
;
SShellObj
**
shellList
=
NULL
;
...
...
@@ -128,7 +129,7 @@ int vnodeInitShell() {
rpcInit
.
idMgmt
=
TAOS_ID_FREE
;
rpcInit
.
connType
=
TAOS_CONN_UDPS
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1200
;
rpcInit
.
qhandle
=
rpcQhandle
;
rpcInit
.
qhandle
=
rpcQhandle
[
0
]
;
rpcInit
.
efp
=
vnodeSendVpeerCfgMsg
;
pShellServer
=
taosOpenRpc
(
&
rpcInit
);
...
...
@@ -155,7 +156,7 @@ int vnodeOpenShellVnode(int vnode) {
memset
(
shellList
[
vnode
],
0
,
size
);
taosOpenRpcChann
(
pShellServer
,
vnode
,
sessions
);
taosOpenRpcChann
WithQ
(
pShellServer
,
vnode
,
sessions
,
rpcQhandle
[(
vnode
+
1
)
%
tsMaxQueues
]
);
return
0
;
}
...
...
src/system/src/vnodeSystem.c
浏览文件 @
d28ee044
...
...
@@ -29,9 +29,10 @@
// internal global, not configurable
void
*
vnodeTmrCtrl
;
void
*
rpcQhandle
;
void
*
*
rpcQhandle
;
void
*
dmQhandle
;
void
*
queryQhandle
;
int
tsMaxQueues
;
uint32_t
tsRebootTime
;
int
vnodeInitSystem
()
{
...
...
@@ -41,9 +42,12 @@ int vnodeInitSystem() {
if
(
numOfThreads
<
1
)
numOfThreads
=
1
;
queryQhandle
=
taosInitScheduler
(
tsNumOfVnodesPerCore
*
tsNumOfCores
*
tsSessionsPerVnode
,
numOfThreads
,
"query"
);
numOfThreads
=
(
1
.
0
-
tsRatioOfQueryThreads
)
*
tsNumOfCores
*
tsNumOfThreadsPerCore
/
2
.
0
;
if
(
numOfThreads
<
1
)
numOfThreads
=
1
;
rpcQhandle
=
taosInitScheduler
(
tsNumOfVnodesPerCore
*
tsNumOfCores
*
tsSessionsPerVnode
,
numOfThreads
,
"dnode"
);
tsMaxQueues
=
(
1
.
0
-
tsRatioOfQueryThreads
)
*
tsNumOfCores
*
tsNumOfThreadsPerCore
/
2
.
0
;
if
(
tsMaxQueues
<
1
)
tsMaxQueues
=
1
;
rpcQhandle
=
malloc
(
tsMaxQueues
*
sizeof
(
void
*
));
for
(
int
i
=
0
;
i
<
tsMaxQueues
;
i
++
)
rpcQhandle
[
i
]
=
taosInitScheduler
(
tsSessionsPerVnode
,
1
,
"dnode"
);
dmQhandle
=
taosInitScheduler
(
tsSessionsPerVnode
,
1
,
"mgmt"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录