Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
a5608cc6
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a5608cc6
编写于
5月 16, 2020
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the PSYNC2 test reliability.
上级
624742d9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
15 deletion
+33
-15
tests/integration/psync2.tcl
tests/integration/psync2.tcl
+33
-15
未找到文件。
tests/integration/psync2.tcl
浏览文件 @
a5608cc6
...
...
@@ -12,7 +12,7 @@ start_server {} {
set no_exit 0
;
# Do not exit at end of the test
set duration
2
0
;
# Total test seconds
set duration
4
0
;
# Total test seconds
set genload 1
;
# Load master with writes at every cycle
...
...
@@ -125,14 +125,16 @@ start_server {} {
}
}
# wait for all the slaves to be in sync with the master, due to pings, we have to re-sample the master constantly too
# wait for all the slaves to be in sync.
set masteroff
[
status $R
(
$master
_id
)
master_repl_offset
]
wait_for_condition 500 100
{
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
0
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
1
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
2
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
3
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
4
)
master_repl_offset
]
[
status $R
(
0
)
master_repl_offset
]
>= $masteroff
&&
[
status $R
(
1
)
master_repl_offset
]
>= $masteroff
&&
[
status $R
(
2
)
master_repl_offset
]
>= $masteroff
&&
[
status $R
(
3
)
master_repl_offset
]
>= $masteroff
&&
[
status $R
(
4
)
master_repl_offset
]
>= $masteroff
}
else
{
puts
"Master ID is
$master
_id"
for
{
set j 0
}
{
$j
< 5
}
{
incr j
}
{
puts
"
$j:
sync_full:
[
status $R
(
$j
)
sync_full
]
"
puts
"
$j:
id1 :
[
status $R
(
$j
)
master_replid
]
:
[
status $R
(
$j
)
master_repl_offset
]
"
...
...
@@ -140,17 +142,11 @@ start_server {} {
puts
"
$j:
backlog : firstbyte=
[
status $R
(
$j
)
repl_backlog_first_byte_offset
]
len=
[
status $R
(
$j
)
repl_backlog_histlen
]
"
puts
"---"
}
fail
"
Slaves are not in sync
with the master after too long time."
fail
"
Replicas offsets didn't catch up
with the master after too long time."
}
# Put down the old master so that it cannot generate more
# replication stream, this way in the next master switch, the time at
# which we move slaves away is not important, each will have full
# history
(
otherwise PINGs will make certain slaves have more history
)
,
# and sometimes a full resync will be needed.
$R
(
$master
_id
)
slaveof 127.0.0.1 0
;
# We use port zero to make it fail.
if
{
$debug
_msg
}
{
puts
"Master ID is
$master
_id"
for
{
set j 0
}
{
$j
< 5
}
{
incr j
}
{
puts
"
$j:
sync_full:
[
status $R
(
$j
)
sync_full
]
"
puts
"
$j:
id1 :
[
status $R
(
$j
)
master_replid
]
:
[
status $R
(
$j
)
master_repl_offset
]
"
...
...
@@ -168,6 +164,28 @@ start_server {} {
assert
{
$sum
== 4
}
}
# In absence of pings, are the instances really able to have
# the exact same offset?
$R
(
$master
_id
)
config set repl-ping-replica-period 3600
wait_for_condition 500 100
{
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
0
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
1
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
2
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
3
)
master_repl_offset
]
&&
[
status $R
(
$master
_id
)
master_repl_offset
]
==
[
status $R
(
4
)
master_repl_offset
]
}
else
{
puts
"Master ID is
$master
_id"
for
{
set j 0
}
{
$j
< 5
}
{
incr j
}
{
puts
"
$j:
sync_full:
[
status $R
(
$j
)
sync_full
]
"
puts
"
$j:
id1 :
[
status $R
(
$j
)
master_replid
]
:
[
status $R
(
$j
)
master_repl_offset
]
"
puts
"
$j:
id2 :
[
status $R
(
$j
)
master_replid2
]
:
[
status $R
(
$j
)
second_repl_offset
]
"
puts
"
$j:
backlog : firstbyte=
[
status $R
(
$j
)
repl_backlog_first_byte_offset
]
len=
[
status $R
(
$j
)
repl_backlog_histlen
]
"
puts
"---"
}
fail
"Replicas and master offsets were unable to match *exactly*."
}
$R
(
$master
_id
)
config set repl-ping-replica-period 10
# Limit anyway the maximum number of cycles. This is useful when the
# test is skipped via --only option of the test suite. In that case
# we don't want to see many seconds of this test being just skipped.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录