Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a32fcd3f
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
a32fcd3f
编写于
12月 21, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2500
上级
e58c470f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
5 deletion
+24
-5
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+1
-1
src/sync/src/syncRestore.c
src/sync/src/syncRestore.c
+8
-3
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+4
-1
tests/script/unique/db/replica_add12.sim
tests/script/unique/db/replica_add12.sim
+2
-0
tests/script/unique/db/replica_add13.sim
tests/script/unique/db/replica_add13.sim
+3
-0
tests/script/unique/db/replica_add23.sim
tests/script/unique/db/replica_add23.sim
+3
-0
tests/script/unique/db/replica_part.sim
tests/script/unique/db/replica_part.sim
+3
-0
未找到文件。
src/sync/src/syncMain.c
浏览文件 @
a32fcd3f
...
@@ -686,7 +686,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
...
@@ -686,7 +686,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
if
(
pMaster
)
{
if
(
pMaster
)
{
// master is there
// master is there
pNode
->
pMaster
=
pMaster
;
pNode
->
pMaster
=
pMaster
;
sDebug
(
"%s, it is the master, replica:
^
%d sver:%"
PRIu64
,
pMaster
->
id
,
pNode
->
replica
,
pMaster
->
version
);
sDebug
(
"%s, it is the master, replica:%d sver:%"
PRIu64
,
pMaster
->
id
,
pNode
->
replica
,
pMaster
->
version
);
if
(
syncValidateMaster
(
pPeer
)
<
0
)
return
;
if
(
syncValidateMaster
(
pPeer
)
<
0
)
return
;
...
...
src/sync/src/syncRestore.c
浏览文件 @
a32fcd3f
...
@@ -90,15 +90,18 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
...
@@ -90,15 +90,18 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
break
;
break
;
}
}
sDebug
(
"%s, file:%s info is received from master, index:%d size:%"
PRId64
" fver:%"
PRIu64
" magic:%d"
,
pPeer
->
id
,
minfo
.
name
,
minfo
.
index
,
minfo
.
size
,
minfo
.
fversion
,
minfo
.
magic
);
// remove extra files on slave between the current and last index
// remove extra files on slave between the current and last index
syncRemoveExtraFile
(
pPeer
,
pindex
+
1
,
minfo
.
index
-
1
);
syncRemoveExtraFile
(
pPeer
,
pindex
+
1
,
minfo
.
index
-
1
);
pindex
=
minfo
.
index
;
pindex
=
minfo
.
index
;
// check the file info
// check the file info
sinfo
=
minfo
;
sinfo
=
minfo
;
s
Debug
(
"%s, get file:%s info size:%"
PRId64
,
pPeer
->
id
,
minfo
.
name
,
minfo
.
size
);
s
info
.
magic
=
(
*
pNode
->
getFileInfo
)(
pNode
->
vgId
,
sinfo
.
name
,
&
sinfo
.
index
,
TAOS_SYNC_MAX_INDEX
,
&
sinfo
.
size
,
&
sinfo
.
fversion
);
s
info
.
magic
=
(
*
pNode
->
getFileInfo
)(
pNode
->
vgId
,
sinfo
.
name
,
&
sinfo
.
index
,
TAOS_SYNC_MAX_INDEX
,
&
sinfo
.
siz
e
,
s
Debug
(
"%s, local file:%s info, index:%d size:%"
PRId64
" fver:%"
PRIu64
" magic:%d"
,
pPeer
->
id
,
sinfo
.
nam
e
,
&
sinfo
.
fversion
);
sinfo
.
index
,
sinfo
.
size
,
sinfo
.
fversion
,
sinfo
.
magic
);
// if file not there or magic is not the same, file shall be synced
// if file not there or magic is not the same, file shall be synced
memset
(
&
fileAck
,
0
,
sizeof
(
SFileAck
));
memset
(
&
fileAck
,
0
,
sizeof
(
SFileAck
));
...
@@ -116,6 +119,8 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
...
@@ -116,6 +119,8 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
if
(
fileAck
.
sync
==
0
)
{
if
(
fileAck
.
sync
==
0
)
{
sDebug
(
"%s, %s is the same"
,
pPeer
->
id
,
minfo
.
name
);
sDebug
(
"%s, %s is the same"
,
pPeer
->
id
,
minfo
.
name
);
continue
;
continue
;
}
else
{
sDebug
(
"%s, %s will be received, size:%"
PRId64
,
pPeer
->
id
,
minfo
.
name
,
minfo
.
size
);
}
}
// if sync is required, open file, receive from master, and write to file
// if sync is required, open file, receive from master, and write to file
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
a32fcd3f
...
@@ -104,7 +104,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
...
@@ -104,7 +104,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
fileInfo
.
magic
=
(
*
pNode
->
getFileInfo
)(
pNode
->
vgId
,
fileInfo
.
name
,
&
fileInfo
.
index
,
TAOS_SYNC_MAX_INDEX
,
fileInfo
.
magic
=
(
*
pNode
->
getFileInfo
)(
pNode
->
vgId
,
fileInfo
.
name
,
&
fileInfo
.
index
,
TAOS_SYNC_MAX_INDEX
,
&
fileInfo
.
size
,
&
fileInfo
.
fversion
);
&
fileInfo
.
size
,
&
fileInfo
.
fversion
);
syncBuildFileInfo
(
&
fileInfo
,
pNode
->
vgId
);
syncBuildFileInfo
(
&
fileInfo
,
pNode
->
vgId
);
sDebug
(
"%s, file:%s info is sent, size:%"
PRId64
,
pPeer
->
id
,
fileInfo
.
name
,
fileInfo
.
size
);
sDebug
(
"%s, file:%s info is sent, index:%d size:%"
PRId64
" fver:%"
PRIu64
" magic:%d"
,
pPeer
->
id
,
fileInfo
.
name
,
fileInfo
.
index
,
fileInfo
.
size
,
fileInfo
.
fversion
,
fileInfo
.
magic
);
// send the file info
// send the file info
int32_t
ret
=
taosWriteMsg
(
pPeer
->
syncFd
,
&
(
fileInfo
),
sizeof
(
SFileInfo
));
int32_t
ret
=
taosWriteMsg
(
pPeer
->
syncFd
,
&
(
fileInfo
),
sizeof
(
SFileInfo
));
...
@@ -144,6 +145,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
...
@@ -144,6 +145,8 @@ static int32_t syncRetrieveFile(SSyncPeer *pPeer) {
fileInfo
.
index
++
;
fileInfo
.
index
++
;
sDebug
(
"%s, %s is the same"
,
pPeer
->
id
,
fileInfo
.
name
);
sDebug
(
"%s, %s is the same"
,
pPeer
->
id
,
fileInfo
.
name
);
continue
;
continue
;
}
else
{
sDebug
(
"%s, %s will be sent"
,
pPeer
->
id
,
fileInfo
.
name
);
}
}
// get the full path to file
// get the full path to file
...
...
tests/script/unique/db/replica_add12.sim
浏览文件 @
a32fcd3f
...
@@ -230,6 +230,7 @@ print online vnodes $data03
...
@@ -230,6 +230,7 @@ print online vnodes $data03
if $data03 != 2 then
if $data03 != 2 then
goto step6
goto step6
endi
endi
sleep 1000
sql insert into d1.t1 values(now, 3)
sql insert into d1.t1 values(now, 3)
sql insert into d2.t2 values(now, 3)
sql insert into d2.t2 values(now, 3)
...
@@ -307,6 +308,7 @@ print online vnodes $data03
...
@@ -307,6 +308,7 @@ print online vnodes $data03
if $data03 != 2 then
if $data03 != 2 then
goto step7
goto step7
endi
endi
sleep 1000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d2.t2 values(now, 5)
...
...
tests/script/unique/db/replica_add13.sim
浏览文件 @
a32fcd3f
...
@@ -238,6 +238,7 @@ print online vnodes $data03
...
@@ -238,6 +238,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step6
goto step6
endi
endi
sleep 1000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -307,6 +308,7 @@ print online vnodes $data03
...
@@ -307,6 +308,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step7
goto step7
endi
endi
sleep 1000
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -372,6 +374,7 @@ print online vnodes $data03
...
@@ -372,6 +374,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step8
goto step8
endi
endi
sleep 1000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
...
...
tests/script/unique/db/replica_add23.sim
浏览文件 @
a32fcd3f
...
@@ -239,6 +239,7 @@ print online vnodes $data03
...
@@ -239,6 +239,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step6
goto step6
endi
endi
sleep 1000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -304,6 +305,7 @@ print online vnodes $data03
...
@@ -304,6 +305,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step7
goto step7
endi
endi
sleep 1000
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -369,6 +371,7 @@ print online vnodes $data03
...
@@ -369,6 +371,7 @@ print online vnodes $data03
if $data03 != 3 then
if $data03 != 3 then
goto step8
goto step8
endi
endi
sleep 1000
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 5000
sleep 5000
...
...
tests/script/unique/db/replica_part.sim
浏览文件 @
a32fcd3f
...
@@ -141,6 +141,7 @@ print online vnodes $data03
...
@@ -141,6 +141,7 @@ print online vnodes $data03
if $data03 != 2 then
if $data03 != 2 then
goto step3
goto step3
endi
endi
sleep 1000
print ========= step4
print ========= step4
sql insert into d1.t1 values(now, 2)
sql insert into d1.t1 values(now, 2)
...
@@ -220,6 +221,7 @@ print online vnodes $data03
...
@@ -220,6 +221,7 @@ print online vnodes $data03
if $data03 != 2 then
if $data03 != 2 then
goto step6
goto step6
endi
endi
sleep 1000
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
sleep 5000
sleep 5000
...
@@ -268,6 +270,7 @@ print online vnodes $data03
...
@@ -268,6 +270,7 @@ print online vnodes $data03
if $data03 != 2 then
if $data03 != 2 then
goto step7
goto step7
endi
endi
sleep 1000
sql insert into d1.t1 values(now, 5)
sql insert into d1.t1 values(now, 5)
sql insert into d2.t2 values(now, 5)
sql insert into d2.t2 values(now, 5)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录