Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
32d0df0c
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,发现更多精彩内容 >>
提交
32d0df0c
编写于
5月 27, 2020
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the PSYNC2 meaningful offset test.
上级
22472fe5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
113 deletion
+0
-113
tests/integration/psync2-pingoff.tcl
tests/integration/psync2-pingoff.tcl
+0
-112
tests/test_helper.tcl
tests/test_helper.tcl
+0
-1
未找到文件。
tests/integration/psync2-pingoff.tcl
已删除
100644 → 0
浏览文件 @
22472fe5
# Test the meaningful offset implementation to make sure masters
# are able to PSYNC with replicas even if the replication stream
# has pending PINGs at the end.
start_server
{
tags
{
"psync2"
}}
{
start_server
{}
{
# Config
set debug_msg 0
;
# Enable additional debug messages
for
{
set j 0
}
{
$j
< 2
}
{
incr j
}
{
set R
(
$j
)
[
srv
[
expr 0-$j
]
client
]
set R_host
(
$j
)
[
srv
[
expr 0-$j
]
host
]
set R_port
(
$j
)
[
srv
[
expr 0-$j
]
port
]
$R
(
$j
)
CONFIG SET repl-ping-replica-period 1
if
{
$debug
_msg
}
{
puts
"Log file:
[
srv
[
expr 0-$j
]
stdout
]
"
}
}
# Setup replication
test
"PSYNC2 meaningful offset: setup"
{
$R
(
1
)
replicaof $R_host
(
0
)
$R_port
(
0
)
$R
(
0
)
set foo bar
wait_for_condition 50 1000
{
[
status $R
(
1
)
master_link_status
]
==
"up"
&&
[
$R
(
0
)
dbsize
]
== 1 &&
[
$R
(
1
)
dbsize
]
== 1
}
else
{
fail
"Replicas not replicating from master"
}
}
test
"PSYNC2 meaningful offset: write and wait replication"
{
$R
(
0
)
INCR counter
$R
(
0
)
INCR counter
$R
(
0
)
INCR counter
wait_for_condition 50 1000
{
[
$R
(
0
)
GET counter
]
eq
[
$R
(
1
)
GET counter
]
}
else
{
fail
"Master and replica don't agree about counter"
}
}
# In this test we'll make sure the replica will get stuck, but with
# an active connection: this way the master will continue to send PINGs
# every second
(
we modified the PING period earlier
)
test
"PSYNC2 meaningful offset: pause replica and promote it"
{
$R
(
1
)
MULTI
$R
(
1
)
DEBUG SLEEP 5
$R
(
1
)
SLAVEOF NO ONE
$R
(
1
)
EXEC
$R
(
1
)
ping
;
# Wait for it to return back available
}
test
"Make the old master a replica of the new one and check conditions"
{
set sync_partial
[
status $R
(
1
)
sync_partial_ok
]
assert
{
$sync
_partial == 0
}
$R
(
0
)
REPLICAOF $R_host
(
1
)
$R_port
(
1
)
wait_for_condition 50 1000
{
[
status $R
(
1
)
sync_partial_ok
]
== 1
}
else
{
fail
"The new master was not able to partial sync"
}
}
}}
start_server
{
tags
{
"psync2"
}}
{
start_server
{}
{
start_server
{}
{
for
{
set j 0
}
{
$j
< 3
}
{
incr j
}
{
set R
(
$j
)
[
srv
[
expr 0-$j
]
client
]
set R_host
(
$j
)
[
srv
[
expr 0-$j
]
host
]
set R_port
(
$j
)
[
srv
[
expr 0-$j
]
port
]
$R
(
$j
)
CONFIG SET repl-ping-replica-period 1
}
test
"Chained replicas disconnect when replica re-connect with the same master"
{
# Add a second replica as a chained replica of the current replica
$R
(
1
)
replicaof $R_host
(
0
)
$R_port
(
0
)
$R
(
2
)
replicaof $R_host
(
1
)
$R_port
(
1
)
wait_for_condition 50 1000
{
[
status $R
(
2
)
master_link_status
]
==
"up"
}
else
{
fail
"Chained replica not replicating from its master"
}
# Do a write on the master, and wait for 3 seconds for the master to
# send some PINGs to its replica
$R
(
0
)
INCR counter2
after 2000
set sync_partial_master
[
status $R
(
0
)
sync_partial_ok
]
set sync_partial_replica
[
status $R
(
1
)
sync_partial_ok
]
$R
(
0
)
CONFIG SET repl-ping-replica-period 100
# Disconnect the master's direct replica
$R
(
0
)
client kill type replica
wait_for_condition 50 1000
{
[
status $R
(
1
)
master_link_status
]
==
"up"
&&
[
status $R
(
2
)
master_link_status
]
==
"up"
&&
[
status $R
(
0
)
sync_partial_ok
]
== $sync_partial_master + 1 &&
[
status $R
(
1
)
sync_partial_ok
]
== $sync_partial_replica + 1
}
else
{
fail
"Disconnected replica failed to PSYNC with master"
}
# Verify that the replica and its replica's meaningful and real
# offsets match with the master
assert_equal
[
status $R
(
0
)
master_repl_offset
]
[
status $R
(
1
)
master_repl_offset
]
assert_equal
[
status $R
(
0
)
master_repl_offset
]
[
status $R
(
2
)
master_repl_offset
]
assert_equal
[
status $R
(
0
)
master_repl_meaningful_offset
]
[
status $R
(
1
)
master_repl_meaningful_offset
]
assert_equal
[
status $R
(
0
)
master_repl_meaningful_offset
]
[
status $R
(
2
)
master_repl_meaningful_offset
]
}
}}}
tests/test_helper.tcl
浏览文件 @
32d0df0c
...
@@ -47,7 +47,6 @@ set ::all_tests {
...
@@ -47,7 +47,6 @@ set ::all_tests {
integration/logging
integration/logging
integration/psync2
integration/psync2
integration/psync2-reg
integration/psync2-reg
integration/psync2-pingoff
unit/pubsub
unit/pubsub
unit/slowlog
unit/slowlog
unit/scripting
unit/scripting
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录