Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
99815378
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
提交
99815378
编写于
11月 24, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2086
上级
11a5fe27
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
19 deletion
+10
-19
src/sync/inc/syncInt.h
src/sync/inc/syncInt.h
+1
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+5
-13
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+4
-6
未找到文件。
src/sync/inc/syncInt.h
浏览文件 @
99815378
...
...
@@ -41,6 +41,7 @@ typedef enum {
#define SYNC_RECV_BUFFER_SIZE (5*1024*1024)
#define SYNC_FWD_TIMER 300
#define SYNC_ROLE_TIMER 10000
#define SYNC_WAIT_AFTER_CHOOSE_MASTER 3
#define nodeRole pNode->peerInfo[pNode->selfIndex]->role
#define nodeVersion pNode->peerInfo[pNode->selfIndex]->version
...
...
src/sync/src/syncMain.c
浏览文件 @
99815378
...
...
@@ -626,17 +626,9 @@ static void syncChooseMaster(SSyncNode *pNode) {
sInfo
(
"vgId:%d, start to work as master"
,
pNode
->
vgId
);
nodeRole
=
TAOS_SYNC_ROLE_MASTER
;
#if 0
for (int32_t i = 0; i < pNode->replica; ++i) {
if (i == index) continue;
pPeer = pNode->peerInfo[i];
if (pPeer->version == nodeVersion) {
pPeer->role = TAOS_SYNC_ROLE_SLAVE;
pPeer->sstatus = TAOS_SYNC_STATUS_CACHE;
sInfo("%s, it shall work as slave", pPeer->id);
}
}
#endif
// Wait for other nodes to receive status to avoid version inconsistency
taosMsleep
(
SYNC_WAIT_AFTER_CHOOSE_MASTER
);
syncResetFlowCtrl
(
pNode
);
(
*
pNode
->
notifyRole
)(
pNode
->
vgId
,
nodeRole
);
}
else
{
...
...
@@ -761,7 +753,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
sDebug
(
"vgId:%d, choose master"
,
pNode
->
vgId
);
syncChooseMaster
(
pNode
);
}
else
{
sDebug
(
"vgId:%d, cannot choose master since roles in
consistent
"
,
pNode
->
vgId
);
sDebug
(
"vgId:%d, cannot choose master since roles in
equality
"
,
pNode
->
vgId
);
}
}
...
...
@@ -1124,7 +1116,7 @@ static void syncProcessIncommingConnection(int32_t connFd, uint32_t sourceIp) {
}
int32_t
vgId
=
firstPkt
.
syncHead
.
vgId
;
SSyncNode
**
ppNode
=
(
SSyncNode
**
)
taosHashGet
(
tsVgIdHash
,
(
const
char
*
)
&
vgId
,
sizeof
(
int32_t
));
SSyncNode
**
ppNode
=
taosHashGet
(
tsVgIdHash
,
&
vgId
,
sizeof
(
int32_t
));
if
(
ppNode
==
NULL
||
*
ppNode
==
NULL
)
{
sError
(
"vgId:%d, vgId could not be found"
,
vgId
);
taosCloseSocket
(
connFd
);
...
...
src/sync/src/syncRestore.c
浏览文件 @
99815378
...
...
@@ -147,12 +147,10 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
static
int32_t
syncRestoreWal
(
SSyncPeer
*
pPeer
)
{
SSyncNode
*
pNode
=
pPeer
->
pSyncNode
;
int32_t
ret
,
code
=
-
1
;
uint64_t
lastVer
=
0
;
void
*
buffer
=
calloc
(
SYNC_MAX_SIZE
,
1
);
// size for one record
if
(
buffer
==
NULL
)
return
-
1
;
SWalHead
*
pHead
=
(
SWalHead
*
)
buffer
;
uint64_t
lastVer
=
0
;
SWalHead
*
pHead
=
calloc
(
SYNC_MAX_SIZE
,
1
);
// size for one record
if
(
pHead
==
NULL
)
return
-
1
;
while
(
1
)
{
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
,
sizeof
(
SWalHead
));
...
...
@@ -188,7 +186,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
sError
(
"%s, failed to restore wal from syncFd:%d since %s"
,
pPeer
->
id
,
pPeer
->
syncFd
,
strerror
(
errno
));
}
free
(
buffer
);
free
(
pHead
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录