Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
f7656ec7
T
TDengine
项目概览
小楼昨夜-听风雨
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f7656ec7
编写于
10月 11, 2020
作者:
陶建辉(Jeff)
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'patch/TD-1669' of
https://github.com/taosdata/TDengine
into patch/TD-1669
上级
77d2880d
86a2019f
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
171 addition
and
68 deletion
+171
-68
src/balance/src/balance.c
src/balance/src/balance.c
+4
-4
src/dnode/src/dnodeMPeer.c
src/dnode/src/dnodeMPeer.c
+1
-1
src/dnode/src/dnodeMRead.c
src/dnode/src/dnodeMRead.c
+1
-1
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+1
-1
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+26
-4
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+6
-1
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+2
-2
src/dnode/src/dnodeVRead.c
src/dnode/src/dnodeVRead.c
+1
-1
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/inc/dnode.h
src/inc/dnode.h
+2
-1
src/inc/taoserror.h
src/inc/taoserror.h
+2
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+6
-1
src/mnode/inc/mnodeMnode.h
src/mnode/inc/mnodeMnode.h
+1
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+1
-1
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+56
-6
src/mnode/src/mnodePeer.c
src/mnode/src/mnodePeer.c
+7
-2
src/mnode/src/mnodeRead.c
src/mnode/src/mnodeRead.c
+11
-4
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+1
-1
src/mnode/src/mnodeWrite.c
src/mnode/src/mnodeWrite.c
+10
-4
src/plugins/http/src/httpQueue.c
src/plugins/http/src/httpQueue.c
+1
-1
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+6
-2
src/util/src/tqueue.c
src/util/src/tqueue.c
+1
-0
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+17
-17
tests/script/test.sh
tests/script/test.sh
+3
-8
tests/script/unique/mnode/mgmt21.sim
tests/script/unique/mnode/mgmt21.sim
+3
-3
未找到文件。
src/balance/src/balance.c
浏览文件 @
f7656ec7
...
...
@@ -957,11 +957,11 @@ static void balanceMonitorDnodeModule() {
continue
;
}
mLInfo
(
"dnode:%d, numOfMnodes:%d expect:%d,
add
mnode in this dnode"
,
pDnode
->
dnodeId
,
numOfMnodes
,
tsNumOfMnodes
);
mnode
AddMnode
(
pDnode
->
dnodeId
);
mLInfo
(
"dnode:%d, numOfMnodes:%d expect:%d,
create
mnode in this dnode"
,
pDnode
->
dnodeId
,
numOfMnodes
,
tsNumOfMnodes
);
mnode
CreateMnode
(
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
true
);
numOfMnodes
=
mnodeGetMnodesNum
();
if
(
numOfMnodes
>=
tsNumOfMnodes
)
return
;
// Only create one mnode each time
return
;
}
}
...
...
src/dnode/src/dnodeMPeer.c
浏览文件 @
f7656ec7
...
...
@@ -148,7 +148,7 @@ static void *dnodeProcessMnodePeerQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMPeerQset
,
&
type
,
(
void
**
)
&
pPeerMsg
,
&
unUsed
)
==
0
)
{
dDebug
(
"
dnodeProcessMnodePeerQueue: got no message from qset, exiting..."
);
dDebug
(
"
qset:%p, mnode peer got no message from qset, exiting"
,
tsMPeerQset
);
break
;
}
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
f7656ec7
...
...
@@ -156,7 +156,7 @@ static void *dnodeProcessMnodeReadQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMReadQset
,
&
type
,
(
void
**
)
&
pReadMsg
,
&
unUsed
)
==
0
)
{
dDebug
(
"
dnodeProcessMnodeReadQueue: got no message from qset, exiting..."
);
dDebug
(
"
qset:%p, mnode read got no message from qset, exiting"
,
tsMReadQset
);
break
;
}
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
f7656ec7
...
...
@@ -158,7 +158,7 @@ static void *dnodeProcessMnodeWriteQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMWriteQset
,
&
type
,
(
void
**
)
&
pWrite
,
&
unUsed
)
==
0
)
{
dDebug
(
"
dnodeProcessMnodeWriteQueue: got no message from qset, exiting..."
);
dDebug
(
"
qset:%p, mnode write got no message from qset, exiting"
,
tsMWriteQset
);
break
;
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
f7656ec7
...
...
@@ -74,14 +74,16 @@ static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *pMsg);
static
int32_t
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessAlterStreamMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessConfigDnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
dnodeProcessCreateMnodeMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
(
*
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
pMsg
);
int32_t
dnodeInitMgmt
()
{
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_VNODE
]
=
dnodeProcessCreateVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_VNODE
]
=
dnodeProcessAlterVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_VNODE
]
=
dnodeProcessAlterVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE
]
=
dnodeProcessDropVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM
]
=
dnodeProcessAlterStreamMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE
]
=
dnodeProcessConfigDnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_MNODE
]
=
dnodeProcessCreateMnodeMsg
;
dnodeAddClientRspHandle
(
TSDB_MSG_TYPE_DM_STATUS_RSP
,
dnodeProcessStatusRsp
);
dnodeReadDnodeCfg
();
...
...
@@ -226,7 +228,7 @@ static void *dnodeProcessMgmtQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsMgmtQset
,
&
type
,
(
void
**
)
&
pMsg
,
&
handle
)
==
0
)
{
dDebug
(
"
dnode mgmt got no message from qset, exit ..."
);
dDebug
(
"
qset:%p, dnode mgmt got no message from qset, exit"
,
tsMgmtQset
);
break
;
}
...
...
@@ -451,10 +453,28 @@ static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg) {
}
static
int32_t
dnodeProcessConfigDnodeMsg
(
SRpcMsg
*
pMsg
)
{
SMDCfgDnodeMsg
*
pCfg
=
(
SMDCfgDnodeMsg
*
)
pMsg
->
pCont
;
SMDCfgDnodeMsg
*
pCfg
=
pMsg
->
pCont
;
return
taosCfgDynamicOptions
(
pCfg
->
config
);
}
static
int32_t
dnodeProcessCreateMnodeMsg
(
SRpcMsg
*
pMsg
)
{
SMDCreateMnodeMsg
*
pCfg
=
pMsg
->
pCont
;
if
(
pCfg
->
dnodeId
!=
dnodeGetDnodeId
())
{
dError
(
"dnodeId:%d in create mnode msg is not equal with saved dnodeId:%d"
,
pCfg
->
dnodeId
,
dnodeGetDnodeId
());
return
TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED
;
}
if
(
strcmp
(
pCfg
->
dnodeEp
,
tsLocalEp
)
!=
0
)
{
dError
(
"dnodeEp:%s in create mnode msg is not equal with saved dnodeEp:%s"
,
pCfg
->
dnodeEp
,
tsLocalEp
);
return
TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED
;
}
dDebug
(
"dnodeId:%d, create mnode msg is received"
,
pCfg
->
dnodeId
);
dnodeStartMnode
();
return
TSDB_CODE_SUCCESS
;
}
void
dnodeUpdateMnodeEpSetForPeer
(
SRpcEpSet
*
pEpSet
)
{
if
(
pEpSet
->
numOfEps
<=
0
)
{
dError
(
"mnode EP list for peer is changed, but content is invalid, discard it"
);
...
...
@@ -466,9 +486,10 @@ void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) {
pEpSet
->
port
[
i
]
-=
TSDB_PORT_DNODEDNODE
;
dInfo
(
"mnode index:%d %s:%u"
,
i
,
pEpSet
->
fqdn
[
i
],
pEpSet
->
port
[
i
]);
#if 0
if (!mnodeIsRunning()) {
if (strcmp(pEpSet->fqdn[i], tsLocalFqdn) == 0 && pEpSet->port[i] == tsServerPort) {
dInfo
(
"mnode index:%d %s:%u should work as mnode"
,
i
,
pEpSet
->
fqdn
[
i
],
pEpSet
->
port
[
i
]);
dInfo("mnode index:%d %s:%u s
elf s
hould work as mnode", i, pEpSet->fqdn[i], pEpSet->port[i]);
bool find = false;
for (int i = 0; i < tsDMnodeInfos.nodeNum; ++i) {
if (tsDMnodeInfos.nodeInfos[i].nodeId == dnodeGetDnodeId()) {
...
...
@@ -488,6 +509,7 @@ void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) {
dnodeStartMnode();
}
}
#endif
}
tsDMnodeEpSet
=
*
pEpSet
;
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
f7656ec7
...
...
@@ -48,6 +48,7 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_DROP_VNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_STREAM
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_CONFIG_DNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_MNODE
]
=
dnodeDispatchToMgmtQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_CONFIG_TABLE
]
=
dnodeDispatchToMnodePeerQueue
;
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_DM_CONFIG_VNODE
]
=
dnodeDispatchToMnodePeerQueue
;
...
...
@@ -170,8 +171,12 @@ void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg) {
rpcSendRequest
(
tsDnodeClientRpc
,
epSet
,
rpcMsg
);
}
void
dnodeSendMsgTo
D
nodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
void
dnodeSendMsgTo
M
nodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
SRpcEpSet
epSet
=
{
0
};
dnodeGetMnodeEpSetForPeer
(
&
epSet
);
rpcSendRecv
(
tsDnodeClientRpc
,
&
epSet
,
rpcMsg
,
rpcRsp
);
}
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
)
{
rpcSendRecv
(
tsDnodeClientRpc
,
epSet
,
rpcMsg
,
rpcRsp
);
}
\ No newline at end of file
src/dnode/src/dnodeShell.c
浏览文件 @
f7656ec7
...
...
@@ -156,7 +156,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
dDebug
(
"user:%s, send auth msg to mnodes"
,
user
);
SRpcMsg
rpcRsp
=
{
0
};
dnodeSendMsgTo
D
nodeRecv
(
&
rpcMsg
,
&
rpcRsp
);
dnodeSendMsgTo
M
nodeRecv
(
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
)
{
dError
(
"user:%s, auth msg received from mnodes, error:%s"
,
user
,
tstrerror
(
rpcRsp
.
code
));
...
...
@@ -189,7 +189,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DM_CONFIG_TABLE
;
SRpcMsg
rpcRsp
=
{
0
};
dnodeSendMsgTo
D
nodeRecv
(
&
rpcMsg
,
&
rpcRsp
);
dnodeSendMsgTo
M
nodeRecv
(
&
rpcMsg
,
&
rpcRsp
);
terrno
=
rpcRsp
.
code
;
if
(
rpcRsp
.
code
!=
0
)
{
...
...
src/dnode/src/dnodeVRead.c
浏览文件 @
f7656ec7
...
...
@@ -199,7 +199,7 @@ static void *dnodeProcessReadQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
readQset
,
&
type
,
(
void
**
)
&
pReadMsg
,
&
pVnode
)
==
0
)
{
dDebug
(
"
dnodeProcessReadQueee: got no message from qset, exiting..."
);
dDebug
(
"
qset:%p dnode read got no message from qset, exiting"
,
readQset
);
break
;
}
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
f7656ec7
...
...
@@ -222,7 +222,7 @@ static void *dnodeProcessWriteQueue(void *param) {
while
(
1
)
{
numOfMsgs
=
taosReadAllQitemsFromQset
(
pWorker
->
qset
,
pWorker
->
qall
,
&
pVnode
);
if
(
numOfMsgs
==
0
)
{
dDebug
(
"
dnodeProcessWriteQueee: got no message from qset, exiting..."
);
dDebug
(
"
qset:%p, dnode write got no message from qset, exiting"
,
pWorker
->
qset
);
break
;
}
...
...
src/inc/dnode.h
浏览文件 @
f7656ec7
...
...
@@ -47,7 +47,8 @@ bool dnodeStartMnode();
void
dnodeAddClientRspHandle
(
uint8_t
msgType
,
void
(
*
fp
)(
SRpcMsg
*
rpcMsg
));
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
);
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
);
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
);
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
sid
);
void
*
dnodeAllocateVnodeWqueue
(
void
*
pVnode
);
...
...
src/inc/taoserror.h
浏览文件 @
f7656ec7
...
...
@@ -139,6 +139,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE, 0, 0x0339, "Vgroup alr
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_FREE
,
0
,
0x033A
,
"Dnode not avaliable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_CLUSTER_ID
,
0
,
0x033B
,
"Cluster id not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NOT_READY
,
0
,
0x033C
,
"Cluster not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED
,
0
,
0x033D
,
"Dnode Id not configured"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED
,
0
,
0x033E
,
"Dnode Ep not configured"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
0
,
0x0340
,
"Account already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT
,
0
,
0x0341
,
"Invalid account"
)
...
...
src/inc/taosmsg.h
浏览文件 @
f7656ec7
...
...
@@ -59,7 +59,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_STABLE, "drop-stable" )
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_ALTER_STREAM
,
"alter-stream"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_CONFIG_DNODE
,
"config-dnode"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_MD_ALTER_VNODE
,
"alter-vnode"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_
DUMMY5
,
"dummy5
"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_
MD_CREATE_MNODE
,
"create-mnode
"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DUMMY6
,
"dummy6"
)
TAOS_DEFINE_MESSAGE_TYPE
(
TSDB_MSG_TYPE_DUMMY7
,
"dummy7"
)
...
...
@@ -719,6 +719,11 @@ typedef struct {
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
}
SCMCreateDnodeMsg
,
SCMDropDnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
char
dnodeEp
[
TSDB_EP_LEN
];
// end point, hostname:port
}
SMDCreateMnodeMsg
;
typedef
struct
{
int32_t
dnodeId
;
int32_t
vgId
;
...
...
src/mnode/inc/mnodeMnode.h
浏览文件 @
f7656ec7
...
...
@@ -31,7 +31,7 @@ typedef enum {
int32_t
mnodeInitMnodes
();
void
mnodeCleanupMnodes
();
int32_t
mnodeAddMnode
(
int32_t
dnodeId
);
void
mnodeCreateMnode
(
int32_t
dnodeId
,
char
*
dnodeEp
,
bool
needConfirm
);
int32_t
mnodeDropMnode
(
int32_t
dnodeId
);
void
mnodeDropMnodeLocal
(
int32_t
dnodeId
);
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
f7656ec7
...
...
@@ -147,7 +147,7 @@ static int32_t mnodeDnodeActionRestored() {
mnodeCreateDnode
(
tsLocalEp
,
NULL
);
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
tsLocalEp
);
if
(
pDnode
!=
NULL
)
{
mnode
AddMnode
(
pDnode
->
dnodeId
);
mnode
CreateMnode
(
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
false
);
mnodeDecDnodeRef
(
pDnode
);
}
}
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
f7656ec7
...
...
@@ -23,6 +23,8 @@
#include "tutil.h"
#include "tsocket.h"
#include "tdataformat.h"
#include "dnode.h"
#include "mnode.h"
#include "mnodeDef.h"
#include "mnodeInt.h"
#include "mnodeMnode.h"
...
...
@@ -30,6 +32,7 @@
#include "mnodeSdb.h"
#include "mnodeShow.h"
#include "mnodeUser.h"
#include "mnodeVgroup.h"
static
void
*
tsMnodeSdb
=
NULL
;
static
int32_t
tsMnodeUpdateSize
=
0
;
...
...
@@ -266,7 +269,46 @@ void mnodeGetMnodeInfos(void *mnodeInfos) {
mnodeMnodeUnLock
();
}
int32_t
mnodeAddMnode
(
int32_t
dnodeId
)
{
static
int32_t
mnodeSendCreateMnodeMsg
(
int32_t
dnodeId
,
char
*
dnodeEp
)
{
mDebug
(
"dnode:%d, send create mnode msg to dnode %s"
,
dnodeId
,
dnodeEp
);
SMDCreateMnodeMsg
*
pCreate
=
rpcMallocCont
(
sizeof
(
SMDCreateMnodeMsg
));
if
(
pCreate
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
else
{
pCreate
->
dnodeId
=
dnodeId
;
tstrncpy
(
pCreate
->
dnodeEp
,
dnodeEp
,
sizeof
(
pCreate
->
dnodeEp
));
}
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pCreate
;
rpcMsg
.
contLen
=
sizeof
(
SMDCreateMnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_MNODE
;
SRpcMsg
rpcRsp
=
{
0
};
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pCreate
->
dnodeEp
);
dnodeSendMsgToDnodeRecv
(
&
rpcMsg
,
&
rpcRsp
,
&
epSet
);
if
(
rpcRsp
.
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"dnode:%d, failed to send create mnode msg, ep:%s reason:%s"
,
dnodeId
,
dnodeEp
,
tstrerror
(
rpcRsp
.
code
));
}
rpcFreeCont
(
rpcRsp
.
pCont
);
return
rpcRsp
.
code
;
}
static
int32_t
mnodeCreateMnodeCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"failed to create mnode, reason:%s"
,
tstrerror
(
code
));
}
else
{
mDebug
(
"mnode is created"
);
mnodeUpdateMnodeEpSet
();
}
return
code
;
}
void
mnodeCreateMnode
(
int32_t
dnodeId
,
char
*
dnodeEp
,
bool
needConfirm
)
{
SMnodeObj
*
pMnode
=
calloc
(
1
,
sizeof
(
SMnodeObj
));
pMnode
->
mnodeId
=
dnodeId
;
pMnode
->
createdTime
=
taosGetTimestampMs
();
...
...
@@ -275,16 +317,24 @@ int32_t mnodeAddMnode(int32_t dnodeId) {
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsMnodeSdb
,
.
pObj
=
pMnode
,
.
writeCb
=
mnodeCreateMnodeCb
};
int32_t
code
=
sdbInsertRow
(
&
oper
)
;
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
taosTFree
(
pMnode
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
needConfirm
)
{
code
=
mnodeSendCreateMnodeMsg
(
dnodeId
,
dnodeEp
);
}
mnodeUpdateMnodeEpSet
();
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosTFree
(
pMnode
);
return
;
}
return
code
;
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%d, failed to create mnode, ep:%s reason:%s"
,
dnodeId
,
dnodeEp
,
tstrerror
(
code
));
taosTFree
(
pMnode
);
}
}
void
mnodeDropMnodeLocal
(
int32_t
dnodeId
)
{
...
...
src/mnode/src/mnodePeer.c
浏览文件 @
f7656ec7
...
...
@@ -58,10 +58,15 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
SRpcEpSet
);
mDebug
(
"%p, msg:%s in mpeer queue
, will be redirec
ed, numOfEps:%d inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
mDebug
(
"%p, msg:%s in mpeer queue
will be redirect
ed, numOfEps:%d inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfEps
;
++
i
)
{
mDebug
(
"mnode index:%d ep:%s:%d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
if
(
strcmp
(
epSet
->
fqdn
[
i
],
tsLocalFqdn
)
==
0
&&
htons
(
epSet
->
port
[
i
])
==
tsServerPort
)
{
epSet
->
inUse
=
(
i
+
1
)
%
epSet
->
numOfEps
;
mDebug
(
"mnode index:%d ep:%s:%u, set inUse to %d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]),
epSet
->
inUse
);
}
else
{
mDebug
(
"mnode index:%d ep:%s:%u"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
}
}
return
TSDB_CODE_RPC_REDIRECT
;
...
...
src/mnode/src/mnodeRead.c
浏览文件 @
f7656ec7
...
...
@@ -51,14 +51,21 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) {
SMnodeRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
SRpcEpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpcEpSet
));
mnodeGetMnodeEpSetForShell
(
epSet
);
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
SRpcEpSet
);
mDebug
(
"%p, msg:%s in mread queue, will be redireced, inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
epSet
->
inUse
);
mDebug
(
"%p, msg:%s in mread queue will be redirected, numOfEps:%d inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfEps
;
++
i
)
{
mDebug
(
"mnode index:%d ep:%s:%d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
if
(
strcmp
(
epSet
->
fqdn
[
i
],
tsLocalFqdn
)
==
0
&&
htons
(
epSet
->
port
[
i
])
==
tsServerPort
)
{
epSet
->
inUse
=
(
i
+
1
)
%
epSet
->
numOfEps
;
mDebug
(
"mnode index:%d ep:%s:%u, set inUse to %d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]),
epSet
->
inUse
);
}
else
{
mDebug
(
"mnode index:%d ep:%s:%u"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
}
}
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
SRpcEpSet
);
return
TSDB_CODE_RPC_REDIRECT
;
}
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
f7656ec7
...
...
@@ -1038,7 +1038,7 @@ static void *sdbWorkerFp(void *param) {
while
(
1
)
{
numOfMsgs
=
taosReadAllQitemsFromQset
(
tsSdbWriteQset
,
tsSdbWriteQall
,
&
unUsed
);
if
(
numOfMsgs
==
0
)
{
sdbDebug
(
"
sdbWorkerFp: got no message from qset, exiting..."
);
sdbDebug
(
"
qset:%p, sdb got no message from qset, exiting"
,
tsSdbWriteQset
);
break
;
}
...
...
src/mnode/src/mnodeWrite.c
浏览文件 @
f7656ec7
...
...
@@ -54,11 +54,17 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
rpcRsp
->
rsp
=
epSet
;
rpcRsp
->
len
=
sizeof
(
SRpcEpSet
);
mDebug
(
"app:%p:%p, msg:%s
will be redireced inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]
,
epSet
->
inUse
);
mDebug
(
"app:%p:%p, msg:%s
in write queue, will be redirected, numOfEps:%d inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
epSet
->
numOfEps
,
epSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfEps
;
++
i
)
{
mDebug
(
"app:%p:%p, mnode index:%d ep:%s:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
if
(
strcmp
(
epSet
->
fqdn
[
i
],
tsLocalFqdn
)
==
0
&&
htons
(
epSet
->
port
[
i
])
==
tsServerPort
)
{
epSet
->
inUse
=
(
i
+
1
)
%
epSet
->
numOfEps
;
mDebug
(
"app:%p:%p, mnode index:%d ep:%s:%d, set inUse to %d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]),
epSet
->
inUse
);
}
else
{
mDebug
(
"app:%p:%p, mnode index:%d ep:%s:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
i
,
epSet
->
fqdn
[
i
],
htons
(
epSet
->
port
[
i
]));
}
}
return
TSDB_CODE_RPC_REDIRECT
;
...
...
src/plugins/http/src/httpQueue.c
浏览文件 @
f7656ec7
...
...
@@ -67,7 +67,7 @@ static void *httpProcessResultQueue(void *param) {
while
(
1
)
{
if
(
taosReadQitemFromQset
(
tsHttpQset
,
&
type
,
(
void
**
)
&
pMsg
,
&
unUsed
)
==
0
)
{
httpDebug
(
"
httpResultQueue: got no message from qset, exiting..."
);
httpDebug
(
"
qset:%p, http queue got no message from qset, exiting"
,
tsHttpQset
);
break
;
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
f7656ec7
...
...
@@ -1120,9 +1120,13 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
SRpcEpSet
*
pEpSet
=
(
SRpcEpSet
*
)
pHead
->
content
;
if
(
pEpSet
->
numOfEps
>
0
)
{
memcpy
(
&
pContext
->
epSet
,
pHead
->
content
,
sizeof
(
pContext
->
epSet
));
tDebug
(
"%s, redirect is received, numOfEps:%d"
,
pConn
->
info
,
pContext
->
epSet
.
numOfEps
);
for
(
int
i
=
0
;
i
<
pContext
->
epSet
.
numOfEps
;
++
i
)
tDebug
(
"%s, redirect is received, numOfEps:%d inUse:%d"
,
pConn
->
info
,
pContext
->
epSet
.
numOfEps
,
pContext
->
epSet
.
inUse
);
for
(
int
i
=
0
;
i
<
pContext
->
epSet
.
numOfEps
;
++
i
)
{
pContext
->
epSet
.
port
[
i
]
=
htons
(
pContext
->
epSet
.
port
[
i
]);
tDebug
(
"%s, redirect is received, index:%d ep:%s:%u"
,
pConn
->
info
,
i
,
pContext
->
epSet
.
fqdn
[
i
],
pContext
->
epSet
.
port
[
i
]);
}
}
rpcSendReqToServer
(
pRpc
,
pContext
);
rpcFreeCont
(
rpcMsg
.
pCont
);
...
...
src/util/src/tqueue.c
浏览文件 @
f7656ec7
...
...
@@ -263,6 +263,7 @@ void taosCloseQset(taos_qset param) {
// thread to exit.
void
taosQsetThreadResume
(
taos_qset
param
)
{
STaosQset
*
qset
=
(
STaosQset
*
)
param
;
uDebug
(
"qset:%p, it will exit"
,
qset
);
tsem_post
(
&
qset
->
sem
);
}
...
...
tests/script/sh/deploy.sh
浏览文件 @
f7656ec7
...
...
@@ -111,24 +111,24 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag 0"
>>
$TAOS_CFG
echo
"mDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"vDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"cDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"jnidebugFlag 1
35
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"httpDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"qdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"mDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"vDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"cDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"jnidebugFlag 1
43
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"httpDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"qdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"udebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"wdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"cqdebugFlag 1
35
"
>>
$TAOS_CFG
echo
"udebugFlag 1
43
"
>>
$TAOS_CFG
echo
"sdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"wdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"cqdebugFlag 1
43
"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
...
...
tests/script/test.sh
浏览文件 @
f7656ec7
...
...
@@ -109,15 +109,10 @@ echo "dataDir $DATA_DIR" >> $TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"scriptDir
${
CODE_DIR
}
/../script"
>>
$TAOS_CFG
echo
"numOfLogLines 100000000"
>>
$TAOS_CFG
echo
"dDebugFlag 135"
>>
$TAOS_CFG
echo
"mDebugFlag 135"
>>
$TAOS_CFG
echo
"sdbDebugFlag 135"
>>
$TAOS_CFG
echo
"rpcDebugFlag 135"
>>
$TAOS_CFG
echo
"rpcDebugFlag 143"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"httpDebugFlag 135"
>>
$TAOS_CFG
echo
"monitorDebugFlag 135"
>>
$TAOS_CFG
echo
"udebugFlag 135"
>>
$TAOS_CFG
echo
"cDebugFlag 143"
>>
$TAOS_CFG
echo
"udebugFlag 143"
>>
$TAOS_CFG
echo
"tablemetakeeptimer 5"
>>
$TAOS_CFG
echo
"wal 0"
>>
$TAOS_CFG
echo
"asyncLog 0"
>>
$TAOS_CFG
...
...
tests/script/unique/mnode/mgmt21.sim
浏览文件 @
f7656ec7
...
...
@@ -25,12 +25,12 @@ sql create dnode $hostname2
$x = 0
show2:
$x = $x + 1
sleep
2
000
if $x ==
10
then
sleep
4
000
if $x ==
5
then
return -1
endi
sql show mnodes
sql show mnodes
-x show2
print dnode1 ==> $data2_1
print dnode2 ==> $data2_2
if $data2_1 != master then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录