Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
ec149ac4
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ec149ac4
编写于
11月 16, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TD-2088
上级
dfb0921c
d9963d3e
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
27 addition
and
24 deletion
+27
-24
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-5
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+2
-0
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+2
-0
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+2
-2
src/inc/trpc.h
src/inc/trpc.h
+3
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+8
-10
src/rpc/test/rclient.c
src/rpc/test/rclient.c
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+1
-0
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+2
-0
src/sync/test/syncClient.c
src/sync/test/syncClient.c
+1
-1
src/util/src/tref.c
src/util/src/tref.c
+2
-2
src/util/src/tsocket.c
src/util/src/tsocket.c
+2
-2
未找到文件。
src/client/src/tscServer.c
浏览文件 @
ec149ac4
...
@@ -241,11 +241,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
...
@@ -241,11 +241,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
.
code
=
0
.
code
=
0
};
};
// NOTE: the rpc context should be acquired before sending data to server.
rpcSendRequest
(
pObj
->
pDnodeConn
,
&
pSql
->
epSet
,
&
rpcMsg
,
&
pSql
->
rpcRid
);
// Otherwise, the pSql object may have been released already during the response function, which is
// processMsgFromServer function. In the meanwhile, the assignment of the rpc context to sql object will absolutely
// cause crash.
pSql
->
rpcRid
=
rpcSendRequest
(
pObj
->
pDnodeConn
,
&
pSql
->
epSet
,
&
rpcMsg
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/client/src/tscSystem.c
浏览文件 @
ec149ac4
...
@@ -105,6 +105,7 @@ void taos_init_imp(void) {
...
@@ -105,6 +105,7 @@ void taos_init_imp(void) {
taosReadGlobalCfg
();
taosReadGlobalCfg
();
taosCheckGlobalCfg
();
taosCheckGlobalCfg
();
rpcInit
();
tscDebug
(
"starting to initialize TAOS client ..."
);
tscDebug
(
"starting to initialize TAOS client ..."
);
tscDebug
(
"Local End Point is:%s"
,
tsLocalEp
);
tscDebug
(
"Local End Point is:%s"
,
tsLocalEp
);
}
}
...
@@ -179,6 +180,7 @@ void taos_cleanup(void) {
...
@@ -179,6 +180,7 @@ void taos_cleanup(void) {
taosCloseRef
(
tscRefId
);
taosCloseRef
(
tscRefId
);
taosCleanupKeywordsTable
();
taosCleanupKeywordsTable
();
taosCloseLog
();
taosCloseLog
();
if
(
tscEmbedded
==
0
)
rpcCleanup
();
m
=
tscTmr
;
m
=
tscTmr
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscTmr
,
m
,
0
)
==
m
)
{
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscTmr
,
m
,
0
)
==
m
)
{
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
ec149ac4
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "tconfig.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tglobal.h"
#include "twal.h"
#include "twal.h"
#include "trpc.h"
#include "dnode.h"
#include "dnode.h"
#include "dnodeInt.h"
#include "dnodeInt.h"
#include "dnodeMgmt.h"
#include "dnodeMgmt.h"
...
@@ -54,6 +55,7 @@ typedef struct {
...
@@ -54,6 +55,7 @@ typedef struct {
}
SDnodeComponent
;
}
SDnodeComponent
;
static
const
SDnodeComponent
tsDnodeComponents
[]
=
{
static
const
SDnodeComponent
tsDnodeComponents
[]
=
{
{
"rpc"
,
rpcInit
,
rpcCleanup
},
{
"storage"
,
dnodeInitStorage
,
dnodeCleanupStorage
},
{
"storage"
,
dnodeInitStorage
,
dnodeCleanupStorage
},
{
"dnodecfg"
,
dnodeInitCfg
,
dnodeCleanupCfg
},
{
"dnodecfg"
,
dnodeInitCfg
,
dnodeCleanupCfg
},
{
"dnodeeps"
,
dnodeInitEps
,
dnodeCleanupEps
},
{
"dnodeeps"
,
dnodeInitEps
,
dnodeCleanupEps
},
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
ec149ac4
...
@@ -169,7 +169,7 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
...
@@ -169,7 +169,7 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
}
}
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsClientRpc
,
epSet
,
rpcMsg
);
rpcSendRequest
(
tsClientRpc
,
epSet
,
rpcMsg
,
NULL
);
}
}
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
...
@@ -180,4 +180,4 @@ void dnodeSendMsgToMnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) {
...
@@ -180,4 +180,4 @@ void dnodeSendMsgToMnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) {
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
)
{
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
)
{
rpcSendRecv
(
tsClientRpc
,
epSet
,
rpcMsg
,
rpcRsp
);
rpcSendRecv
(
tsClientRpc
,
epSet
,
rpcMsg
,
rpcRsp
);
}
}
\ No newline at end of file
src/inc/trpc.h
浏览文件 @
ec149ac4
...
@@ -78,12 +78,14 @@ typedef struct SRpcInit {
...
@@ -78,12 +78,14 @@ typedef struct SRpcInit {
int
(
*
afp
)(
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int
(
*
afp
)(
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
}
SRpcInit
;
}
SRpcInit
;
int32_t
rpcInit
();
void
rpcCleanup
();
void
*
rpcOpen
(
const
SRpcInit
*
pRpc
);
void
*
rpcOpen
(
const
SRpcInit
*
pRpc
);
void
rpcClose
(
void
*
);
void
rpcClose
(
void
*
);
void
*
rpcMallocCont
(
int
contLen
);
void
*
rpcMallocCont
(
int
contLen
);
void
rpcFreeCont
(
void
*
pCont
);
void
rpcFreeCont
(
void
*
pCont
);
void
*
rpcReallocCont
(
void
*
ptr
,
int
contLen
);
void
*
rpcReallocCont
(
void
*
ptr
,
int
contLen
);
int64_t
rpcSendRequest
(
void
*
thandle
,
const
SRpcEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
rpcSendRequest
(
void
*
thandle
,
const
SRpcEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
rid
);
void
rpcSendResponse
(
const
SRpcMsg
*
pMsg
);
void
rpcSendResponse
(
const
SRpcMsg
*
pMsg
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
SRpcEpSet
*
pEpSet
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
SRpcEpSet
*
pEpSet
);
int
rpcGetConnInfo
(
void
*
thandle
,
SRpcConnInfo
*
pInfo
);
int
rpcGetConnInfo
(
void
*
thandle
,
SRpcConnInfo
*
pInfo
);
...
...
src/rpc/src/rpcMain.c
浏览文件 @
ec149ac4
...
@@ -135,7 +135,7 @@ int tsRpcOverhead;
...
@@ -135,7 +135,7 @@ int tsRpcOverhead;
static
int
tsRpcRefId
=
-
1
;
static
int
tsRpcRefId
=
-
1
;
static
int32_t
tsRpcNum
=
0
;
static
int32_t
tsRpcNum
=
0
;
static
pthread_once_t
tsRpcInit
=
PTHREAD_ONCE_INIT
;
//
static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT;
// server:0 client:1 tcp:2 udp:0
// server:0 client:1 tcp:2 udp:0
#define RPC_CONN_UDPS 0
#define RPC_CONN_UDPS 0
...
@@ -221,13 +221,15 @@ static void rpcFree(void *p) {
...
@@ -221,13 +221,15 @@ static void rpcFree(void *p) {
free
(
p
);
free
(
p
);
}
}
void
rpcInit
(
void
)
{
int32_t
rpcInit
(
void
)
{
tsProgressTimer
=
tsRpcTimer
/
2
;
tsProgressTimer
=
tsRpcTimer
/
2
;
tsRpcMaxRetry
=
tsRpcMaxTime
*
1000
/
tsProgressTimer
;
tsRpcMaxRetry
=
tsRpcMaxTime
*
1000
/
tsProgressTimer
;
tsRpcHeadSize
=
RPC_MSG_OVERHEAD
;
tsRpcHeadSize
=
RPC_MSG_OVERHEAD
;
tsRpcOverhead
=
sizeof
(
SRpcReqContext
);
tsRpcOverhead
=
sizeof
(
SRpcReqContext
);
tsRpcRefId
=
taosOpenRef
(
200
,
rpcFree
);
tsRpcRefId
=
taosOpenRef
(
200
,
rpcFree
);
return
0
;
}
}
void
rpcCleanup
(
void
)
{
void
rpcCleanup
(
void
)
{
...
@@ -238,7 +240,7 @@ void rpcCleanup(void) {
...
@@ -238,7 +240,7 @@ void rpcCleanup(void) {
void
*
rpcOpen
(
const
SRpcInit
*
pInit
)
{
void
*
rpcOpen
(
const
SRpcInit
*
pInit
)
{
SRpcInfo
*
pRpc
;
SRpcInfo
*
pRpc
;
pthread_once
(
&
tsRpcInit
,
rpcInit
);
//
pthread_once(&tsRpcInit, rpcInit);
pRpc
=
(
SRpcInfo
*
)
calloc
(
1
,
sizeof
(
SRpcInfo
));
pRpc
=
(
SRpcInfo
*
)
calloc
(
1
,
sizeof
(
SRpcInfo
));
if
(
pRpc
==
NULL
)
return
NULL
;
if
(
pRpc
==
NULL
)
return
NULL
;
...
@@ -379,7 +381,7 @@ void *rpcReallocCont(void *ptr, int contLen) {
...
@@ -379,7 +381,7 @@ void *rpcReallocCont(void *ptr, int contLen) {
return
start
+
sizeof
(
SRpcReqContext
)
+
sizeof
(
SRpcHead
);
return
start
+
sizeof
(
SRpcReqContext
)
+
sizeof
(
SRpcHead
);
}
}
int64_t
rpcSendRequest
(
void
*
shandle
,
const
SRpcEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
void
rpcSendRequest
(
void
*
shandle
,
const
SRpcEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
pRid
)
{
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
SRpcReqContext
*
pContext
;
SRpcReqContext
*
pContext
;
...
@@ -405,14 +407,10 @@ int64_t rpcSendRequest(void *shandle, const SRpcEpSet *pEpSet, SRpcMsg *pMsg) {
...
@@ -405,14 +407,10 @@ int64_t rpcSendRequest(void *shandle, const SRpcEpSet *pEpSet, SRpcMsg *pMsg) {
||
type
==
TSDB_MSG_TYPE_CM_SHOW
)
||
type
==
TSDB_MSG_TYPE_CM_SHOW
)
pContext
->
connType
=
RPC_CONN_TCPC
;
pContext
->
connType
=
RPC_CONN_TCPC
;
// set the handle to pContext, so app can cancel the request
if
(
pMsg
->
handle
)
*
((
void
**
)
pMsg
->
handle
)
=
pContext
;
pContext
->
rid
=
taosAddRef
(
tsRpcRefId
,
pContext
);
pContext
->
rid
=
taosAddRef
(
tsRpcRefId
,
pContext
);
if
(
pRid
)
*
pRid
=
pContext
->
rid
;
rpcSendReqToServer
(
pRpc
,
pContext
);
rpcSendReqToServer
(
pRpc
,
pContext
);
return
pContext
->
rid
;
}
}
void
rpcSendResponse
(
const
SRpcMsg
*
pRsp
)
{
void
rpcSendResponse
(
const
SRpcMsg
*
pRsp
)
{
...
@@ -528,7 +526,7 @@ void rpcSendRecv(void *shandle, SRpcEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
...
@@ -528,7 +526,7 @@ void rpcSendRecv(void *shandle, SRpcEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
pContext
->
pRsp
=
pRsp
;
pContext
->
pRsp
=
pRsp
;
pContext
->
pSet
=
pEpSet
;
pContext
->
pSet
=
pEpSet
;
rpcSendRequest
(
shandle
,
pEpSet
,
pMsg
);
rpcSendRequest
(
shandle
,
pEpSet
,
pMsg
,
NULL
);
tsem_wait
(
&
sem
);
tsem_wait
(
&
sem
);
tsem_destroy
(
&
sem
);
tsem_destroy
(
&
sem
);
...
...
src/rpc/test/rclient.c
浏览文件 @
ec149ac4
...
@@ -57,7 +57,7 @@ static void *sendRequest(void *param) {
...
@@ -57,7 +57,7 @@ static void *sendRequest(void *param) {
rpcMsg
.
ahandle
=
pInfo
;
rpcMsg
.
ahandle
=
pInfo
;
rpcMsg
.
msgType
=
1
;
rpcMsg
.
msgType
=
1
;
tDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
tDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
,
NULL
);
if
(
pInfo
->
num
%
20000
==
0
)
if
(
pInfo
->
num
%
20000
==
0
)
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
tsem_wait
(
&
pInfo
->
rspSem
);
tsem_wait
(
&
pInfo
->
rspSem
);
...
...
src/sync/src/syncMain.c
浏览文件 @
ec149ac4
...
@@ -578,6 +578,7 @@ static void syncChooseMaster(SSyncNode *pNode) {
...
@@ -578,6 +578,7 @@ static void syncChooseMaster(SSyncNode *pNode) {
#if 0
#if 0
for (int32_t i = 0; i < pNode->replica; ++i) {
for (int32_t i = 0; i < pNode->replica; ++i) {
if (i == index) continue;
pPeer = pNode->peerInfo[i];
pPeer = pNode->peerInfo[i];
if (pPeer->version == nodeVersion) {
if (pPeer->version == nodeVersion) {
pPeer->role = TAOS_SYNC_ROLE_SLAVE;
pPeer->role = TAOS_SYNC_ROLE_SLAVE;
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
ec149ac4
...
@@ -182,6 +182,8 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead, uint32_t *pEve
...
@@ -182,6 +182,8 @@ static int32_t syncReadOneWalRecord(int32_t sfd, SWalHead *pHead, uint32_t *pEve
return
0
;
return
0
;
}
}
assert
(
pHead
->
len
<=
TSDB_MAX_WAL_SIZE
);
ret
=
read
(
sfd
,
pHead
->
cont
,
pHead
->
len
);
ret
=
read
(
sfd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
<
0
)
return
-
1
;
if
(
ret
<
0
)
return
-
1
;
...
...
src/sync/test/syncClient.c
浏览文件 @
ec149ac4
...
@@ -57,7 +57,7 @@ void *sendRequest(void *param) {
...
@@ -57,7 +57,7 @@ void *sendRequest(void *param) {
rpcMsg
.
ahandle
=
pInfo
;
rpcMsg
.
ahandle
=
pInfo
;
rpcMsg
.
msgType
=
1
;
rpcMsg
.
msgType
=
1
;
uDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
uDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
epSet
,
&
rpcMsg
,
NULL
);
if
(
pInfo
->
num
%
20000
==
0
)
{
if
(
pInfo
->
num
%
20000
==
0
)
{
uInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
uInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
}
}
...
...
src/util/src/tref.c
浏览文件 @
ec149ac4
...
@@ -426,11 +426,11 @@ static int taosDecRefCount(int rsetId, int64_t rid, int remove) {
...
@@ -426,11 +426,11 @@ static int taosDecRefCount(int rsetId, int64_t rid, int remove) {
(
*
pSet
->
fp
)(
pNode
->
p
);
(
*
pSet
->
fp
)(
pNode
->
p
);
uTrace
(
"rsetId:%d p:%p rid:%"
PRId64
"is removed, count:%d, free mem: %p"
,
rsetId
,
pNode
->
p
,
rid
,
pSet
->
count
,
pNode
);
uTrace
(
"rsetId:%d p:%p rid:%"
PRId64
"
is removed, count:%d, free mem: %p"
,
rsetId
,
pNode
->
p
,
rid
,
pSet
->
count
,
pNode
);
free
(
pNode
);
free
(
pNode
);
released
=
1
;
released
=
1
;
}
else
{
}
else
{
uTrace
(
"rsetId:%d p:%p rid:%"
PRId64
"is released, count:%d"
,
rsetId
,
pNode
->
p
,
rid
,
pNode
->
count
);
uTrace
(
"rsetId:%d p:%p rid:%"
PRId64
"
is released, count:%d"
,
rsetId
,
pNode
->
p
,
rid
,
pNode
->
count
);
}
}
}
else
{
}
else
{
uTrace
(
"rsetId:%d rid:%"
PRId64
" is not there, failed to release/remove"
,
rsetId
,
rid
);
uTrace
(
"rsetId:%d rid:%"
PRId64
" is not there, failed to release/remove"
,
rsetId
,
rid
);
...
...
src/util/src/tsocket.c
浏览文件 @
ec149ac4
...
@@ -107,7 +107,7 @@ int32_t taosWriteMsg(SOCKET fd, void *buf, int32_t nbytes) {
...
@@ -107,7 +107,7 @@ int32_t taosWriteMsg(SOCKET fd, void *buf, int32_t nbytes) {
while
(
nleft
>
0
)
{
while
(
nleft
>
0
)
{
nwritten
=
(
int32_t
)
taosWriteSocket
(
fd
,
(
char
*
)
ptr
,
(
size_t
)
nleft
);
nwritten
=
(
int32_t
)
taosWriteSocket
(
fd
,
(
char
*
)
ptr
,
(
size_t
)
nleft
);
if
(
nwritten
<=
0
)
{
if
(
nwritten
<=
0
)
{
if
(
errno
==
EINTR
)
if
(
errno
==
EINTR
||
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
continue
;
continue
;
else
else
return
-
1
;
return
-
1
;
...
@@ -133,7 +133,7 @@ int32_t taosReadMsg(SOCKET fd, void *buf, int32_t nbytes) {
...
@@ -133,7 +133,7 @@ int32_t taosReadMsg(SOCKET fd, void *buf, int32_t nbytes) {
if
(
nread
==
0
)
{
if
(
nread
==
0
)
{
break
;
break
;
}
else
if
(
nread
<
0
)
{
}
else
if
(
nread
<
0
)
{
if
(
errno
==
EINTR
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
continue
;
continue
;
}
else
{
}
else
{
return
-
1
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录