Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5029e7da
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5029e7da
编写于
11月 19, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2153
上级
a82d594a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
5 deletion
+13
-5
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+4
-4
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+9
-1
未找到文件。
src/sync/src/syncMain.c
浏览文件 @
5029e7da
...
@@ -172,7 +172,7 @@ void syncCleanUp() {
...
@@ -172,7 +172,7 @@ void syncCleanUp() {
int64_t
syncStart
(
const
SSyncInfo
*
pInfo
)
{
int64_t
syncStart
(
const
SSyncInfo
*
pInfo
)
{
const
SSyncCfg
*
pCfg
=
&
pInfo
->
syncCfg
;
const
SSyncCfg
*
pCfg
=
&
pInfo
->
syncCfg
;
SSyncNode
*
pNode
=
(
SSyncNode
*
)
calloc
(
sizeof
(
SSyncNode
),
1
);
SSyncNode
*
pNode
=
calloc
(
sizeof
(
SSyncNode
),
1
);
if
(
pNode
==
NULL
)
{
if
(
pNode
==
NULL
)
{
sError
(
"no memory to allocate syncNode"
);
sError
(
"no memory to allocate syncNode"
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
@@ -207,8 +207,8 @@ int64_t syncStart(const SSyncInfo *pInfo) {
...
@@ -207,8 +207,8 @@ int64_t syncStart(const SSyncInfo *pInfo) {
const
SNodeInfo
*
pNodeInfo
=
pCfg
->
nodeInfo
+
i
;
const
SNodeInfo
*
pNodeInfo
=
pCfg
->
nodeInfo
+
i
;
pNode
->
peerInfo
[
i
]
=
syncAddPeer
(
pNode
,
pNodeInfo
);
pNode
->
peerInfo
[
i
]
=
syncAddPeer
(
pNode
,
pNodeInfo
);
if
(
pNode
->
peerInfo
[
i
]
==
NULL
)
{
if
(
pNode
->
peerInfo
[
i
]
==
NULL
)
{
sError
(
"vgId:%d, node:%d fqdn:%s port:%u is not configured, stop taosd"
,
pNode
->
vgId
,
pNodeInfo
->
nodeId
,
pNodeInfo
->
nodeFqdn
,
sError
(
"vgId:%d, node:%d fqdn:%s port:%u is not configured, stop taosd"
,
pNode
->
vgId
,
pNodeInfo
->
nodeId
,
pNodeInfo
->
nodePort
);
pNodeInfo
->
node
Fqdn
,
pNodeInfo
->
node
Port
);
syncStop
(
pNode
->
rid
);
syncStop
(
pNode
->
rid
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -419,7 +419,7 @@ void syncRecover(int64_t rid) {
...
@@ -419,7 +419,7 @@ void syncRecover(int64_t rid) {
pthread_mutex_lock(&(pNode->mutex));
pthread_mutex_lock(&(pNode->mutex));
for (int32_t i = 0; i < pNode->replica; ++i) {
for (int32_t i = 0; i < pNode->replica; ++i) {
pPeer =
(SSyncPeer *)
pNode->peerInfo[i];
pPeer = pNode->peerInfo[i];
if (pPeer->peerFd >= 0) {
if (pPeer->peerFd >= 0) {
syncRestartConnection(pPeer);
syncRestartConnection(pPeer);
}
}
...
...
src/sync/src/syncRestore.c
浏览文件 @
5029e7da
...
@@ -140,6 +140,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
...
@@ -140,6 +140,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
if
(
buffer
==
NULL
)
return
-
1
;
if
(
buffer
==
NULL
)
return
-
1
;
SWalHead
*
pHead
=
(
SWalHead
*
)
buffer
;
SWalHead
*
pHead
=
(
SWalHead
*
)
buffer
;
uint64_t
lastVer
=
0
;
while
(
1
)
{
while
(
1
)
{
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
,
sizeof
(
SWalHead
));
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
,
sizeof
(
SWalHead
));
...
@@ -153,7 +154,14 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
...
@@ -153,7 +154,14 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
->
cont
,
pHead
->
len
);
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
<
0
)
break
;
if
(
ret
<
0
)
break
;
sDebug
(
"%s, restore a record, qtype:wal hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
version
);
sDebug
(
"%s, restore a record, qtype:wal len:%d hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
len
,
pHead
->
version
);
if
(
lastVer
!=
0
&&
lastVer
==
pHead
->
version
)
{
sError
(
"%s, failed to restore record, same hver:%"
PRIu64
", wal sync failed"
PRIu64
,
pPeer
->
id
,
lastVer
);
break
;
}
lastVer
=
pHead
->
version
;
(
*
pNode
->
writeToCache
)(
pNode
->
ahandle
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
(
*
pNode
->
writeToCache
)(
pNode
->
ahandle
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录