Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
66c6e5ba
T
TDengine
项目概览
哥们要飞
/
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,发现更多精彩内容 >>
提交
66c6e5ba
编写于
11月 20, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change sync log
上级
7749987f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
12 addition
and
14 deletion
+12
-14
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+7
-8
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+3
-2
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+2
-4
未找到文件。
src/sync/src/syncMain.c
浏览文件 @
66c6e5ba
...
...
@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#include <stdint.h>
//#include <stdbool.h>
#define _DEFAULT_SOURCE
#include "os.h"
#include "hash.h"
#include "tlog.h"
...
...
@@ -392,7 +391,7 @@ void syncConfirmForward(int64_t rid, uint64_t version, int32_t code) {
int32_t
retLen
=
taosWriteMsg
(
pPeer
->
peerFd
,
msg
,
msgLen
);
if
(
retLen
==
msgLen
)
{
s
Debug
(
"%s, forward-rsp is sent, code:%x hver:%"
PRIu64
,
pPeer
->
id
,
code
,
version
);
s
Trace
(
"%s, forward-rsp is sent, code:%x hver:%"
PRIu64
,
pPeer
->
id
,
code
,
version
);
}
else
{
sDebug
(
"%s, failed to send forward ack, restart"
,
pPeer
->
id
);
syncRestartConnection
(
pPeer
);
...
...
@@ -891,7 +890,7 @@ static void syncProcessFwdResponse(char *cont, SSyncPeer *pPeer) {
SSyncFwds
*
pSyncFwds
=
pNode
->
pSyncFwds
;
SFwdInfo
*
pFwdInfo
;
s
Debug
(
"%s, forward-rsp is received, code:%x hver:%"
PRIu64
,
pPeer
->
id
,
pFwdRsp
->
code
,
pFwdRsp
->
version
);
s
Trace
(
"%s, forward-rsp is received, code:%x hver:%"
PRIu64
,
pPeer
->
id
,
pFwdRsp
->
code
,
pFwdRsp
->
version
);
SFwdInfo
*
pFirst
=
pSyncFwds
->
fwdInfo
+
pSyncFwds
->
first
;
if
(
pFirst
->
version
<=
pFwdRsp
->
version
&&
pSyncFwds
->
fwds
>
0
)
{
...
...
@@ -910,7 +909,7 @@ static void syncProcessForwardFromPeer(char *cont, SSyncPeer *pPeer) {
SSyncNode
*
pNode
=
pPeer
->
pSyncNode
;
SWalHead
*
pHead
=
(
SWalHead
*
)
cont
;
s
Debug
(
"%s, forward is received, hver:%"
PRIu64
", len:%d"
,
pPeer
->
id
,
pHead
->
version
,
pHead
->
len
);
s
Trace
(
"%s, forward is received, hver:%"
PRIu64
", len:%d"
,
pPeer
->
id
,
pHead
->
version
,
pHead
->
len
);
if
(
nodeRole
==
TAOS_SYNC_ROLE_SLAVE
)
{
// nodeVersion = pHead->version;
...
...
@@ -1191,7 +1190,7 @@ static void syncSaveFwdInfo(SSyncNode *pNode, uint64_t version, void *mhandle) {
pFwdInfo
->
time
=
time
;
pSyncFwds
->
fwds
++
;
s
Debug
(
"vgId:%d, fwd info is saved, hver:%"
PRIu64
" fwds:%d "
,
pNode
->
vgId
,
version
,
pSyncFwds
->
fwds
);
s
Trace
(
"vgId:%d, fwd info is saved, hver:%"
PRIu64
" fwds:%d "
,
pNode
->
vgId
,
version
,
pSyncFwds
->
fwds
);
}
static
void
syncRemoveConfirmedFwdInfo
(
SSyncNode
*
pNode
)
{
...
...
@@ -1228,7 +1227,7 @@ static void syncProcessFwdAck(SSyncNode *pNode, SFwdInfo *pFwdInfo, int32_t code
}
if
(
confirm
&&
pFwdInfo
->
confirmed
==
0
)
{
s
Debug
(
"vgId:%d, forward is confirmed, hver:%"
PRIu64
" code:%x"
,
pNode
->
vgId
,
pFwdInfo
->
version
,
pFwdInfo
->
code
);
s
Trace
(
"vgId:%d, forward is confirmed, hver:%"
PRIu64
" code:%x"
,
pNode
->
vgId
,
pFwdInfo
->
version
,
pFwdInfo
->
code
);
(
*
pNode
->
confirmForward
)(
pNode
->
ahandle
,
pFwdInfo
->
mhandle
,
pFwdInfo
->
code
);
pFwdInfo
->
confirmed
=
1
;
}
...
...
@@ -1335,7 +1334,7 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
int32_t
retLen
=
write
(
pPeer
->
peerFd
,
pSyncHead
,
fwdLen
);
if
(
retLen
==
fwdLen
)
{
s
Debug
(
"%s, forward is sent, hver:%"
PRIu64
" contLen:%d"
,
pPeer
->
id
,
pWalHead
->
version
,
pWalHead
->
len
);
s
Trace
(
"%s, forward is sent, hver:%"
PRIu64
" contLen:%d"
,
pPeer
->
id
,
pWalHead
->
version
,
pWalHead
->
len
);
}
else
{
sError
(
"%s, failed to forward, hver:%"
PRIu64
" retLen:%d"
,
pPeer
->
id
,
pWalHead
->
version
,
retLen
);
syncRestartConnection
(
pPeer
);
...
...
src/sync/src/syncRestore.c
浏览文件 @
66c6e5ba
...
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tlog.h"
#include "tutil.h"
...
...
@@ -154,7 +155,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
ret
=
taosReadMsg
(
pPeer
->
syncFd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
<
0
)
break
;
s
Debug
(
"%s, restore a record, qtype:wal len:%d hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
len
,
pHead
->
version
);
s
Trace
(
"%s, restore a record, qtype:wal len:%d hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
len
,
pHead
->
version
);
if
(
lastVer
==
pHead
->
version
)
{
sError
(
"%s, failed to restore record, same hver:%"
PRIu64
", wal sync failed"
PRIu64
,
pPeer
->
id
,
lastVer
);
...
...
@@ -222,7 +223,7 @@ int32_t syncSaveIntoBuffer(SSyncPeer *pPeer, SWalHead *pHead) {
memcpy
(
pRecv
->
offset
,
pHead
,
len
);
pRecv
->
offset
+=
len
;
pRecv
->
forwards
++
;
s
Debug
(
"%s, fwd is saved into queue, hver:%"
PRIu64
" fwds:%d"
,
pPeer
->
id
,
pHead
->
version
,
pRecv
->
forwards
);
s
Trace
(
"%s, fwd is saved into queue, hver:%"
PRIu64
" fwds:%d"
,
pPeer
->
id
,
pHead
->
version
,
pRecv
->
forwards
);
}
else
{
sError
(
"%s, buffer size:%d is too small"
,
pPeer
->
id
,
pRecv
->
bufferSize
);
pRecv
->
code
=
-
1
;
// set error code
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
66c6e5ba
...
...
@@ -13,10 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdbool.h>
#define _DEFAULT_SOURCE
#include <sys/inotify.h>
#include <unistd.h>
#include "os.h"
#include "tlog.h"
#include "tutil.h"
...
...
@@ -268,7 +266,7 @@ static int32_t syncRetrieveLastWal(SSyncPeer *pPeer, char *name, uint64_t fversi
break
;
}
s
Debug
(
"%s, last wal is forwarded, hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
version
);
s
Trace
(
"%s, last wal is forwarded, hver:%"
PRIu64
,
pPeer
->
id
,
pHead
->
version
);
int32_t
ret
=
taosWriteMsg
(
pPeer
->
syncFd
,
pHead
,
wsize
);
if
(
ret
!=
wsize
)
break
;
pPeer
->
sversion
=
pHead
->
version
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录