Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2b887c41
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看板
提交
2b887c41
编写于
11月 20, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2000
上级
b07924de
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
21 deletion
+23
-21
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+7
-6
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+3
-2
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+9
-9
src/sync/src/tarbitrator.c
src/sync/src/tarbitrator.c
+4
-4
未找到文件。
src/sync/src/syncMain.c
浏览文件 @
2b887c41
...
...
@@ -820,7 +820,7 @@ static void syncProcessSyncRequest(char *msg, SSyncPeer *pPeer) {
pthread_attr_destroy
(
&
thattr
);
if
(
ret
!=
0
)
{
sError
(
"%s, failed to create sync thread
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to create sync thread
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
syncDecPeerRef
(
pPeer
);
}
else
{
pPeer
->
sstatus
=
TAOS_SYNC_STATUS_START
;
...
...
@@ -1105,7 +1105,7 @@ static void syncProcessIncommingConnection(int32_t connFd, uint32_t sourceIp) {
SFirstPkt
firstPkt
;
if
(
taosReadMsg
(
connFd
,
&
firstPkt
,
sizeof
(
firstPkt
))
!=
sizeof
(
firstPkt
))
{
sError
(
"failed to read peer first pkt from ip:%s
(%s)
"
,
ipstr
,
strerror
(
errno
));
sError
(
"failed to read peer first pkt from ip:%s
since %s
"
,
ipstr
,
strerror
(
errno
));
taosCloseSocket
(
connFd
);
return
;
}
...
...
@@ -1159,7 +1159,7 @@ static void syncProcessBrokenLink(void *param) {
if
(
taosAcquireRef
(
tsSyncRefId
,
pNode
->
rid
)
==
NULL
)
return
;
pthread_mutex_lock
(
&
(
pNode
->
mutex
));
sDebug
(
"%s, TCP link is broken
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sDebug
(
"%s, TCP link is broken
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
pPeer
->
peerFd
=
-
1
;
if
(
syncDecPeerRef
(
pPeer
)
!=
0
)
{
...
...
@@ -1242,9 +1242,10 @@ static void syncMonitorNodeRole(void *param, void *tmrId) {
if
(
index
==
pNode
->
selfIndex
)
continue
;
SSyncPeer
*
pPeer
=
pNode
->
peerInfo
[
index
];
if
(
pPeer
->
role
<=
TAOS_SYNC_ROLE_UNSYNCED
||
nodeRole
<=
TAOS_SYNC_ROLE_UNSYNCED
)
{
syncSendPeersStatusMsgToPeer
(
pPeer
,
1
,
SYNC_STATUS_CHECK_ROLE
,
syncGenTranId
());
}
if
(
pPeer
->
role
>
TAOS_SYNC_ROLE_UNSYNCED
&&
nodeRole
>
TAOS_SYNC_ROLE_UNSYNCED
)
continue
;
if
(
pPeer
->
sstatus
>
TAOS_SYNC_STATUS_INIT
||
nodeSStatus
>
TAOS_SYNC_STATUS_INIT
)
continue
;
syncSendPeersStatusMsgToPeer
(
pPeer
,
1
,
SYNC_STATUS_CHECK_ROLE
,
syncGenTranId
());
}
pNode
->
pRoleTimer
=
taosTmrStart
(
syncMonitorNodeRole
,
SYNC_ROLE_TIMER
,
(
void
*
)
pNode
->
rid
,
tsSyncTmrCtrl
);
...
...
src/sync/src/syncRestore.c
浏览文件 @
2b887c41
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#include "tlog.h"
#include "tutil.h"
#include "ttimer.h"
...
...
@@ -127,7 +128,7 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
}
if
(
code
<
0
)
{
sError
(
"%s, failed to restore %s
(%s)
"
,
pPeer
->
id
,
name
,
strerror
(
errno
));
sError
(
"%s, failed to restore %s
since %s
"
,
pPeer
->
id
,
name
,
strerror
(
errno
));
}
return
code
;
...
...
@@ -167,7 +168,7 @@ static int32_t syncRestoreWal(SSyncPeer *pPeer) {
}
if
(
code
<
0
)
{
sError
(
"%s, failed to restore wal
(%s)"
,
pPeer
->
i
d
,
strerror
(
errno
));
sError
(
"%s, failed to restore wal
from syncFd:%d since %s"
,
pPeer
->
id
,
pPeer
->
syncF
d
,
strerror
(
errno
));
}
free
(
buffer
);
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
2b887c41
...
...
@@ -32,7 +32,7 @@ static int32_t syncAddIntoWatchList(SSyncPeer *pPeer, char *name) {
pPeer
->
watchNum
=
0
;
pPeer
->
notifyFd
=
inotify_init1
(
IN_NONBLOCK
);
if
(
pPeer
->
notifyFd
<
0
)
{
sError
(
"%s, failed to init inotify
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to init inotify
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -49,14 +49,14 @@ static int32_t syncAddIntoWatchList(SSyncPeer *pPeer, char *name) {
if
(
*
wd
>=
0
)
{
if
(
inotify_rm_watch
(
pPeer
->
notifyFd
,
*
wd
)
<
0
)
{
sError
(
"%s, failed to remove wd:%d
(%s)
"
,
pPeer
->
id
,
*
wd
,
strerror
(
errno
));
sError
(
"%s, failed to remove wd:%d
since %s
"
,
pPeer
->
id
,
*
wd
,
strerror
(
errno
));
return
-
1
;
}
}
*
wd
=
inotify_add_watch
(
pPeer
->
notifyFd
,
name
,
IN_MODIFY
|
IN_DELETE
);
if
(
*
wd
==
-
1
)
{
sError
(
"%s, failed to add %s
(%s)
"
,
pPeer
->
id
,
name
,
strerror
(
errno
));
sError
(
"%s, failed to add %s
since %s
"
,
pPeer
->
id
,
name
,
strerror
(
errno
));
return
-
1
;
}
else
{
sDebug
(
"%s, monitor %s, wd:%d watchNum:%d"
,
pPeer
->
id
,
name
,
*
wd
,
pPeer
->
watchNum
);
...
...
@@ -73,7 +73,7 @@ static int32_t syncAreFilesModified(SSyncPeer *pPeer) {
char
buf
[
2048
];
int32_t
len
=
read
(
pPeer
->
notifyFd
,
buf
,
sizeof
(
buf
));
if
(
len
<
0
&&
errno
!=
EAGAIN
)
{
sError
(
"%s, failed to read notify FD
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to read notify FD
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -159,7 +159,7 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
}
if
(
code
<
0
)
{
sError
(
"%s, failed to retrieve file
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to retrieve file
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
}
return
code
;
...
...
@@ -199,7 +199,7 @@ static int32_t syncMonitorLastWal(SSyncPeer *pPeer, char *name) {
taosClose
(
pPeer
->
notifyFd
);
pPeer
->
notifyFd
=
inotify_init1
(
IN_NONBLOCK
);
if
(
pPeer
->
notifyFd
<
0
)
{
sError
(
"%s, failed to init inotify
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to init inotify
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -214,7 +214,7 @@ static int32_t syncMonitorLastWal(SSyncPeer *pPeer, char *name) {
*
wd
=
inotify_add_watch
(
pPeer
->
notifyFd
,
name
,
IN_MODIFY
|
IN_CLOSE_WRITE
);
if
(
*
wd
==
-
1
)
{
sError
(
"%s, failed to watch last wal
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to watch last wal
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -225,7 +225,7 @@ static int32_t syncCheckLastWalChanges(SSyncPeer *pPeer, uint32_t *pEvent) {
char
buf
[
2048
];
int32_t
len
=
read
(
pPeer
->
notifyFd
,
buf
,
sizeof
(
buf
));
if
(
len
<
0
&&
errno
!=
EAGAIN
)
{
sError
(
"%s, failed to read notify FD
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to read notify FD
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
return
-
1
;
}
...
...
@@ -422,7 +422,7 @@ static int32_t syncRetrieveWal(SSyncPeer *pPeer) {
memset
(
&
walHead
,
0
,
sizeof
(
walHead
));
code
=
taosWriteMsg
(
pPeer
->
syncFd
,
&
walHead
,
sizeof
(
walHead
));
}
else
{
sError
(
"%s, failed to send wal
(%s)
"
,
pPeer
->
id
,
strerror
(
errno
));
sError
(
"%s, failed to send wal
since %s
"
,
pPeer
->
id
,
strerror
(
errno
));
}
return
code
;
...
...
src/sync/src/tarbitrator.c
浏览文件 @
2b887c41
...
...
@@ -115,14 +115,14 @@ static void arbProcessIncommingConnection(int32_t connFd, uint32_t sourceIp) {
SFirstPkt
firstPkt
;
if
(
taosReadMsg
(
connFd
,
&
firstPkt
,
sizeof
(
firstPkt
))
!=
sizeof
(
firstPkt
))
{
sError
(
"failed to read peer first pkt from ip:%s
(%s)
"
,
ipstr
,
strerror
(
errno
));
sError
(
"failed to read peer first pkt from ip:%s
since %s
"
,
ipstr
,
strerror
(
errno
));
taosCloseSocket
(
connFd
);
return
;
}
SNodeConn
*
pNode
=
(
SNodeConn
*
)
calloc
(
sizeof
(
SNodeConn
),
1
);
SNodeConn
*
pNode
=
calloc
(
sizeof
(
SNodeConn
),
1
);
if
(
pNode
==
NULL
)
{
sError
(
"failed to allocate memory
(%s)
"
,
strerror
(
errno
));
sError
(
"failed to allocate memory
since %s
"
,
strerror
(
errno
));
taosCloseSocket
(
connFd
);
return
;
}
...
...
@@ -146,7 +146,7 @@ static void arbProcessIncommingConnection(int32_t connFd, uint32_t sourceIp) {
static
void
arbProcessBrokenLink
(
void
*
param
)
{
SNodeConn
*
pNode
=
param
;
sDebug
(
"%s, TCP link is broken
(%s)
, close connection"
,
pNode
->
id
,
strerror
(
errno
));
sDebug
(
"%s, TCP link is broken
since %s
, close connection"
,
pNode
->
id
,
strerror
(
errno
));
tfree
(
pNode
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录