Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7ec3c82c
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ec3c82c
编写于
5月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/feature/sync-mnode-integration' into fix/mnode
上级
2f32e122
43a62936
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
49 addition
and
6 deletion
+49
-6
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+7
-1
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+7
-1
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+1
-1
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+4
-0
source/libs/sync/src/syncCommit.c
source/libs/sync/src/syncCommit.c
+4
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+25
-2
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+1
-1
未找到文件。
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
7ec3c82c
...
@@ -17,7 +17,13 @@
...
@@ -17,7 +17,13 @@
#include "mndSync.h"
#include "mndSync.h"
#include "mndTrans.h"
#include "mndTrans.h"
int32_t
mndSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
return
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
}
int32_t
mndSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
if
(
code
!=
0
)
{
rpcFreeCont
(
pMsg
->
pCont
);
}
return
code
;
}
int32_t
mndSyncSendMsg
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
return
tmsgSendReq
(
pEpSet
,
pMsg
);
}
int32_t
mndSyncSendMsg
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
return
tmsgSendReq
(
pEpSet
,
pMsg
);
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
7ec3c82c
...
@@ -56,7 +56,13 @@ void vnodeSyncStart(SVnode *pVnode) {
...
@@ -56,7 +56,13 @@ void vnodeSyncStart(SVnode *pVnode) {
void
vnodeSyncClose
(
SVnode
*
pVnode
)
{
syncStop
(
pVnode
->
sync
);
}
void
vnodeSyncClose
(
SVnode
*
pVnode
)
{
syncStop
(
pVnode
->
sync
);
}
int32_t
vnodeSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
return
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
}
int32_t
vnodeSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
if
(
code
!=
0
)
{
rpcFreeCont
(
pMsg
->
pCont
);
}
return
code
;
}
int32_t
vnodeSyncSendMsg
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
return
tmsgSendReq
(
pEpSet
,
pMsg
);
}
int32_t
vnodeSyncSendMsg
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
return
tmsgSendReq
(
pEpSet
,
pMsg
);
}
...
...
source/libs/sync/inc/syncInt.h
浏览文件 @
7ec3c82c
...
@@ -149,7 +149,7 @@ typedef struct SSyncNode {
...
@@ -149,7 +149,7 @@ typedef struct SSyncNode {
// restore state
// restore state
bool
restoreFinish
;
bool
restoreFinish
;
sem_t
restoreSem
;
//
sem_t restoreSem;
SSnapshot
*
pSnapshot
;
SSnapshot
*
pSnapshot
;
}
SSyncNode
;
}
SSyncNode
;
...
...
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
7ec3c82c
...
@@ -366,8 +366,12 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
...
@@ -366,8 +366,12 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
ths
->
pFsm
->
FpRestoreFinish
(
ths
->
pFsm
);
ths
->
pFsm
->
FpRestoreFinish
(
ths
->
pFsm
);
}
}
ths
->
restoreFinish
=
true
;
ths
->
restoreFinish
=
true
;
sInfo
(
"==syncNodeOnAppendEntriesCb== restoreFinish set true %p vgId:%d"
,
ths
,
ths
->
vgId
);
/*
tsem_post(&ths->restoreSem);
tsem_post(&ths->restoreSem);
sInfo("==syncNodeOnAppendEntriesCb== RestoreFinish tsem_post %p", ths);
*/
}
}
}
}
...
...
source/libs/sync/src/syncCommit.c
浏览文件 @
7ec3c82c
...
@@ -143,8 +143,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
...
@@ -143,8 +143,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
pSyncNode
->
pFsm
->
FpRestoreFinish
(
pSyncNode
->
pFsm
);
pSyncNode
->
pFsm
->
FpRestoreFinish
(
pSyncNode
->
pFsm
);
}
}
pSyncNode
->
restoreFinish
=
true
;
pSyncNode
->
restoreFinish
=
true
;
sInfo
(
"==syncMaybeAdvanceCommitIndex== restoreFinish set true %p vgId:%d"
,
pSyncNode
,
pSyncNode
->
vgId
);
/*
tsem_post(&pSyncNode->restoreSem);
tsem_post(&pSyncNode->restoreSem);
sInfo("==syncMaybeAdvanceCommitIndex== RestoreFinish tsem_post %p", pSyncNode);
*/
}
}
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
7ec3c82c
...
@@ -499,7 +499,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pSyncInfo) {
...
@@ -499,7 +499,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pSyncInfo) {
pSyncNode
->
pSnapshot
=
taosMemoryMalloc
(
sizeof
(
SSnapshot
));
pSyncNode
->
pSnapshot
=
taosMemoryMalloc
(
sizeof
(
SSnapshot
));
pSyncNode
->
pFsm
->
FpGetSnapshot
(
pSyncNode
->
pFsm
,
pSyncNode
->
pSnapshot
);
pSyncNode
->
pFsm
->
FpGetSnapshot
(
pSyncNode
->
pFsm
,
pSyncNode
->
pSnapshot
);
}
}
tsem_init
(
&
(
pSyncNode
->
restoreSem
),
0
,
0
);
//
tsem_init(&(pSyncNode->restoreSem), 0, 0);
// start in syncNodeStart
// start in syncNodeStart
// start raft
// start raft
...
@@ -521,7 +521,19 @@ void syncNodeStart(SSyncNode* pSyncNode) {
...
@@ -521,7 +521,19 @@ void syncNodeStart(SSyncNode* pSyncNode) {
syncNodeAppendNoop
(
pSyncNode
);
syncNodeAppendNoop
(
pSyncNode
);
syncMaybeAdvanceCommitIndex
(
pSyncNode
);
// maybe only one replica
syncMaybeAdvanceCommitIndex
(
pSyncNode
);
// maybe only one replica
/*
sInfo("==syncNodeStart== RestoreFinish begin 1 replica tsem_wait %p", pSyncNode);
tsem_wait(&pSyncNode->restoreSem);
tsem_wait(&pSyncNode->restoreSem);
sInfo("==syncNodeStart== RestoreFinish end 1 replica tsem_wait %p", pSyncNode);
*/
/*
while (pSyncNode->restoreFinish != true) {
taosMsleep(10);
}
*/
sInfo
(
"==syncNodeStart== restoreFinish ok 1 replica %p vgId:%d"
,
pSyncNode
,
pSyncNode
->
vgId
);
return
;
return
;
}
}
...
@@ -532,7 +544,18 @@ void syncNodeStart(SSyncNode* pSyncNode) {
...
@@ -532,7 +544,18 @@ void syncNodeStart(SSyncNode* pSyncNode) {
// ret = syncNodeStartPingTimer(pSyncNode);
// ret = syncNodeStartPingTimer(pSyncNode);
assert
(
ret
==
0
);
assert
(
ret
==
0
);
/*
sInfo("==syncNodeStart== RestoreFinish begin multi replica tsem_wait %p", pSyncNode);
tsem_wait(&pSyncNode->restoreSem);
tsem_wait(&pSyncNode->restoreSem);
sInfo("==syncNodeStart== RestoreFinish end multi replica tsem_wait %p", pSyncNode);
*/
/*
while (pSyncNode->restoreFinish != true) {
taosMsleep(10);
}
*/
sInfo
(
"==syncNodeStart== restoreFinish ok multi replica %p vgId:%d"
,
pSyncNode
,
pSyncNode
->
vgId
);
}
}
void
syncNodeStartStandBy
(
SSyncNode
*
pSyncNode
)
{
void
syncNodeStartStandBy
(
SSyncNode
*
pSyncNode
)
{
...
@@ -573,7 +596,7 @@ void syncNodeClose(SSyncNode* pSyncNode) {
...
@@ -573,7 +596,7 @@ void syncNodeClose(SSyncNode* pSyncNode) {
taosMemoryFree
(
pSyncNode
->
pSnapshot
);
taosMemoryFree
(
pSyncNode
->
pSnapshot
);
}
}
tsem_destroy
(
&
pSyncNode
->
restoreSem
);
//
tsem_destroy(&pSyncNode->restoreSem);
// free memory in syncFreeNode
// free memory in syncFreeNode
// taosMemoryFree(pSyncNode);
// taosMemoryFree(pSyncNode);
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
7ec3c82c
...
@@ -94,7 +94,7 @@ typedef void* queue[2];
...
@@ -94,7 +94,7 @@ typedef void* queue[2];
/* Return the structure holding the given element. */
/* Return the structure holding the given element. */
#define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field))))
#define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field))))
#define TRANS_RETRY_COUNT_LIMIT
2
0 // retry count limit
#define TRANS_RETRY_COUNT_LIMIT
10
0 // retry count limit
#define TRANS_RETRY_INTERVAL 15 // ms retry interval
#define TRANS_RETRY_INTERVAL 15 // ms retry interval
#define TRANS_CONN_TIMEOUT 3 // connect timeout
#define TRANS_CONN_TIMEOUT 3 // connect timeout
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录