Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a3f12736
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看板
提交
a3f12736
编写于
6月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: mnode sync
上级
01521a25
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
38 deletion
+27
-38
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-3
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
+3
-1
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-1
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
+4
-11
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+6
-8
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+2
-2
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+1
-3
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+9
-9
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
a3f12736
...
...
@@ -32,9 +32,7 @@ typedef struct {
int32_t
dnodeId
;
bool
standby
;
bool
deploy
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
SReplica
replica
;
SMsgCb
msgCb
;
}
SMnodeOpt
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmFile.c
浏览文件 @
a3f12736
...
...
@@ -86,12 +86,14 @@ int32_t mmReadFile(SMnodeMgmt *pMgmt, SReplica *pReplica, bool *pDeployed) {
}
code
=
0
;
dDebug
(
"succcessed to read file %s, deployed:%d"
,
file
,
*
pDeployed
);
_OVER:
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
if
(
root
!=
NULL
)
cJSON_Delete
(
root
);
if
(
pFile
!=
NULL
)
taosCloseFile
(
&
pFile
);
if
(
code
==
0
)
{
dDebug
(
"succcessed to read file %s, deployed:%d"
,
file
,
*
pDeployed
);
}
terrno
=
code
;
return
code
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
a3f12736
...
...
@@ -126,7 +126,7 @@ int32_t mmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg) {
SArray
*
mmGetMsgHandles
()
{
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
64
,
sizeof
(
SMgmtHandle
));
SArray
*
pArray
=
taosArrayInit
(
128
,
sizeof
(
SMgmtHandle
));
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_MNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
浏览文件 @
a3f12736
...
...
@@ -43,13 +43,9 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, const SMgmtInputOpt *pInpu
pOption
->
deploy
=
true
;
pOption
->
msgCb
=
pMgmt
->
msgCb
;
pOption
->
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
pOption
->
replica
=
1
;
pOption
->
selfIndex
=
0
;
SReplica
*
pReplica
=
&
pOption
->
replicas
[
0
];
pReplica
->
id
=
1
;
pReplica
->
port
=
tsServerPort
;
tstrncpy
(
pReplica
->
fqdn
,
tsLocalFqdn
,
TSDB_FQDN_LEN
);
pOption
->
replica
.
id
=
1
;
pOption
->
replica
.
port
=
tsServerPort
;
tstrncpy
(
pOption
->
replica
.
fqdn
,
tsLocalFqdn
,
TSDB_FQDN_LEN
);
}
static
void
mmBuildOptionForOpen
(
SMnodeMgmt
*
pMgmt
,
const
SReplica
*
pReplica
,
SMnodeOpt
*
pOption
)
{
...
...
@@ -57,12 +53,9 @@ static void mmBuildOptionForOpen(SMnodeMgmt *pMgmt, const SReplica *pReplica, SM
pOption
->
deploy
=
false
;
pOption
->
msgCb
=
pMgmt
->
msgCb
;
pOption
->
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
if
(
pReplica
->
id
>
0
)
{
pOption
->
standby
=
true
;
pOption
->
replica
=
1
;
pOption
->
selfIndex
=
0
;
memcpy
(
&
pOption
->
replicas
[
0
],
pReplica
,
sizeof
(
SReplica
));
pOption
->
replica
=
*
pReplica
;
}
}
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
a3f12736
...
...
@@ -76,11 +76,12 @@ typedef struct {
}
STelemMgmt
;
typedef
struct
{
sem_t
syncSem
;
int64_t
sync
;
bool
standby
;
int32_t
errCode
;
int32_t
transId
;
sem_t
syncSem
;
int64_t
sync
;
bool
standby
;
SReplica
replica
;
int32_t
errCode
;
int32_t
transId
;
}
SSyncMgmt
;
typedef
struct
{
...
...
@@ -98,9 +99,6 @@ typedef struct SMnode {
bool
stopped
;
bool
restored
;
bool
deploy
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
char
*
path
;
int64_t
checkTime
;
SSdb
*
pSdb
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
a3f12736
...
...
@@ -95,8 +95,8 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
dnodeObj
.
id
=
1
;
dnodeObj
.
createdTime
=
taosGetTimestampMs
();
dnodeObj
.
updateTime
=
dnodeObj
.
createdTime
;
dnodeObj
.
port
=
pMnode
->
replicas
[
0
].
p
ort
;
memcpy
(
&
dnodeObj
.
fqdn
,
pMnode
->
replicas
[
0
].
f
qdn
,
TSDB_FQDN_LEN
);
dnodeObj
.
port
=
tsServerP
ort
;
memcpy
(
&
dnodeObj
.
fqdn
,
tsLocalF
qdn
,
TSDB_FQDN_LEN
);
snprintf
(
dnodeObj
.
ep
,
TSDB_EP_LEN
,
"%s:%u"
,
dnodeObj
.
fqdn
,
dnodeObj
.
port
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
NULL
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
a3f12736
...
...
@@ -289,11 +289,9 @@ static int32_t mndExecSteps(SMnode *pMnode) {
}
static
void
mndSetOptions
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
pMnode
->
replica
=
pOption
->
replica
;
pMnode
->
selfIndex
=
pOption
->
selfIndex
;
memcpy
(
&
pMnode
->
replicas
,
pOption
->
replicas
,
sizeof
(
SReplica
)
*
TSDB_MAX_REPLICA
);
pMnode
->
msgCb
=
pOption
->
msgCb
;
pMnode
->
selfDnodeId
=
pOption
->
dnodeId
;
pMnode
->
syncMgmt
.
replica
=
pOption
->
replica
;
pMnode
->
syncMgmt
.
standby
=
pOption
->
standby
;
}
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
a3f12736
...
...
@@ -188,15 +188,15 @@ int32_t mndInitSync(SMnode *pMnode) {
syncInfo
.
isStandBy
=
pMgmt
->
standby
;
syncInfo
.
snapshotEnable
=
true
;
SSyncCfg
*
pCfg
=
&
syncInfo
.
syncCfg
;
pCfg
->
replicaNum
=
pMnode
->
replica
;
pCfg
->
myIndex
=
pMnode
->
selfIndex
;
mInfo
(
"start to open mnode sync, replica:%d myindex:%d standby:%d"
,
pCfg
->
replicaNum
,
pCfg
->
myIndex
,
pMgmt
->
standby
)
;
for
(
int32_t
i
=
0
;
i
<
pMnode
->
replica
;
++
i
)
{
SNodeInfo
*
pNode
=
&
pCfg
->
nodeInfo
[
i
];
tstrncpy
(
pNode
->
nodeFqdn
,
pM
node
->
replicas
[
i
]
.
fqdn
,
sizeof
(
pNode
->
nodeFqdn
));
pNode
->
nodePort
=
pM
node
->
replicas
[
i
]
.
port
;
mInfo
(
"
index:%d, fqdn:%s port:%d"
,
i
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
mInfo
(
"start to open mnode sync, standby:%d"
,
pMgmt
->
standby
)
;
if
(
pMgmt
->
standby
||
pMgmt
->
replica
.
id
>
0
)
{
SSyncCfg
*
pCfg
=
&
syncInfo
.
syncCfg
;
pCfg
->
replicaNum
=
1
;
pCfg
->
myIndex
=
0
;
SNodeInfo
*
pNode
=
&
pCfg
->
nodeInfo
[
0
];
tstrncpy
(
pNode
->
nodeFqdn
,
pM
gmt
->
replica
.
fqdn
,
sizeof
(
pNode
->
nodeFqdn
));
pNode
->
nodePort
=
pM
gmt
->
replica
.
port
;
mInfo
(
"
fqdn:%s port:%u"
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
tsem_init
(
&
pMgmt
->
syncSem
,
0
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录