Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
484cfc3d
Commit
484cfc3d
authored
May 27, 2020
by
antirez
Browse files
Another meaningful offset test removed.
parent
32d0df0c
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/integration/psync2.tcl
View file @
484cfc3d
...
@@ -370,103 +370,3 @@ start_server {} {
...
@@ -370,103 +370,3 @@ start_server {} {
}
}
}}}}}
}}}}}
start_server
{
tags
{
"psync2"
}}
{
start_server
{}
{
start_server
{}
{
start_server
{}
{
start_server
{}
{
test
{
pings at the end of replication stream are ignored for psync
}
{
set master
[
srv -4 client
]
set master_host
[
srv -4 host
]
set master_port
[
srv -4 port
]
set replica1
[
srv -3 client
]
set replica2
[
srv -2 client
]
set replica3
[
srv -1 client
]
set replica4
[
srv -0 client
]
$replica1 replicaof $master_host $master_port
$replica2 replicaof $master_host $master_port
$replica3 replicaof $master_host $master_port
$replica4 replicaof $master_host $master_port
wait_for_condition 50 1000
{
[
status $master connected_slaves
]
== 4
}
else
{
fail
"replicas didn't connect"
}
$master incr x
wait_for_condition 50 1000
{
[
$replica1
get x
]
== 1 &&
[
$replica2
get x
]
== 1 &&
[
$replica3
get x
]
== 1 &&
[
$replica4
get x
]
== 1
}
else
{
fail
"replicas didn't get incr"
}
# disconnect replica1 and replica2
# and wait for the master to send a ping to replica3 and replica4
$replica1 replicaof no one
$replica2 replicaof 127.0.0.1 1
;
# we can't promote it to master since that will cycle the replication id
$master config set repl-ping-replica-period 1
after 1500
# make everyone sync from the replica1 that didn't get the last ping from the old master
# replica4 will keep syncing from the old master which now syncs from replica1
# and replica2 will re-connect to the old master
(
which went back in time
)
set new_master_host
[
srv -3 host
]
set new_master_port
[
srv -3 port
]
$replica3 replicaof $new_master_host $new_master_port
$master replicaof $new_master_host $new_master_port
$replica2 replicaof $master_host $master_port
wait_for_condition 50 1000
{
[
status $replica2 master_link_status
]
==
"up"
&&
[
status $replica3 master_link_status
]
==
"up"
&&
[
status $replica4 master_link_status
]
==
"up"
&&
[
status $master master_link_status
]
==
"up"
}
else
{
fail
"replicas didn't connect"
}
# make sure replication is still alive and kicking
$replica1 incr x
wait_for_condition 50 1000
{
[
$replica2
get x
]
== 2 &&
[
$replica3
get x
]
== 2 &&
[
$replica4
get x
]
== 2 &&
[
$master
get x
]
== 2
}
else
{
fail
"replicas didn't get incr"
}
# make sure there are full syncs other than the initial ones
assert_equal
[
status $master sync_full
]
4
assert_equal
[
status $replica1 sync_full
]
0
assert_equal
[
status $replica2 sync_full
]
0
assert_equal
[
status $replica3 sync_full
]
0
assert_equal
[
status $replica4 sync_full
]
0
# force psync
$master client kill type master
$replica2 client kill type master
$replica3 client kill type master
$replica4 client kill type master
# make sure replication is still alive and kicking
$replica1 incr x
wait_for_condition 50 1000
{
[
$replica2
get x
]
== 3 &&
[
$replica3
get x
]
== 3 &&
[
$replica4
get x
]
== 3 &&
[
$master
get x
]
== 3
}
else
{
fail
"replicas didn't get incr"
}
# make sure there are full syncs other than the initial ones
assert_equal
[
status $master sync_full
]
4
assert_equal
[
status $replica1 sync_full
]
0
assert_equal
[
status $replica2 sync_full
]
0
assert_equal
[
status $replica3 sync_full
]
0
assert_equal
[
status $replica4 sync_full
]
0
}
}}}}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment