You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by wa...@apache.org on 2022/06/28 12:44:30 UTC
[incubator-kvrocks] branch unstable updated: Fix some time dependencies in replication.tcl (#688)
This is an automated email from the ASF dual-hosted git repository.
wangyuan pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 5a4aa2e Fix some time dependencies in replication.tcl (#688)
5a4aa2e is described below
commit 5a4aa2e686e43750a59cc4f5906190e7cc9a18d7
Author: Wang Yuan <wa...@baidu.com>
AuthorDate: Tue Jun 28 20:44:26 2022 +0800
Fix some time dependencies in replication.tcl (#688)
---
tests/tcl/tests/integration/replication.tcl | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/tests/tcl/tests/integration/replication.tcl b/tests/tcl/tests/integration/replication.tcl
index 09135af..e04d7ab 100644
--- a/tests/tcl/tests/integration/replication.tcl
+++ b/tests/tcl/tests/integration/replication.tcl
@@ -79,9 +79,8 @@ start_server {tags {"repl"}} {
s role
} {slave}
- after 3000
+ wait_for_sync r
test {Sync should have transferred keys from master} {
- after 100
assert_equal [r -1 get mykey] [r get mykey]
assert_equal [r -1 get mystring] [r get mystring]
assert_equal [r -1 lrange mylist 0 -1] [r lrange mylist 0 -1]
@@ -150,7 +149,9 @@ start_server {tags {"repl"}} {
test {Multi slaves full sync with master at the same time} {
$A slaveof $C_host $C_port
$B slaveof $C_host $C_port
- after 1000
+
+ wait_for_sync $A
+ wait_for_sync $B
# Wait for finishing full replication
wait_for_condition 500 100 {
@@ -200,9 +201,9 @@ start_server {tags {"repl"} overrides {max-replication-mb 1 rocksdb.compression
} else {
fail "Fail to resume broken transfer based files"
}
- after 1000
# Slave loads checkpoint successfully
+ wait_for_sync r
assert_equal b [r get a]
}
}
@@ -236,7 +237,8 @@ start_server {tags {"repl"}} {
} else {
fail "Fail to share one checkpoint"
}
- after 1000
+ wait_for_sync $slave1
+ wait_for_sync $slave2
assert_equal b [$slave1 get a]
assert_equal b [$slave2 get a]
}
@@ -248,20 +250,16 @@ start_server {tags {"repl"}} {
set slave [srv 0 client]
start_server {} {
$slave slaveof [srv 0 host] [srv 0 port]
+ wait_for_sync $slave
+
test {Master doesn't pause replicating with replicas, #346} {
- r set a b
- wait_for_condition 500 100 {
- [string match {*connected*} [$slave role]]
- } else {
- fail "Slaves can't sync with master"
- }
# In #346, we find a bug, if one command contains more than special
# number updates, master won't send replication stream to replicas.
r hset myhash 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 \
a a b b c c d d e e f f g g h h i i j j k k
assert_equal 21 [r hlen myhash]
- after 100
+ wait_for_ofs_sync r $slave
assert_equal 1 [$slave hget myhash 1]
assert_equal a [$slave hget myhash a]
}
@@ -278,7 +276,7 @@ start_server {tags {"repl"}} {
set master_port [srv 0 port]
test {Slave can re-sync with master after password change} {
$slave slaveof $master_ip $master_port
- after 200
+ wait_for_sync $slave
catch {$slave info replication} var
assert_match {*role:slave*} $var
catch {$master info replication} var
@@ -304,7 +302,7 @@ start_server {tags {"repl"}} {
}
$master client kill $conn_addr
- after 200
+ wait_for_sync $slave
catch {$master info replication} var
assert_match {*role:master*[$slave_ip]*[$slave_port]*} $var
}