-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replica redirect read&write to master in standalone mode
Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
- Loading branch information
Showing
6 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
start_server {tags {needs:repl external:skip}} { | ||
start_server {} { | ||
set master_host [srv -1 host] | ||
set master_port [srv -1 port] | ||
|
||
r replicaof $master_host $master_port | ||
wait_for_condition 50 100 { | ||
[s 0 master_link_status] eq {up} | ||
} else { | ||
fail "Replicas not replicating from master" | ||
} | ||
|
||
test {replica allow read command by default} { | ||
r get foo | ||
} {} | ||
|
||
test {replica reply READONLY error for write command by default} { | ||
assert_error {READONLY*} {r set foo bar} | ||
} | ||
|
||
test {replica redirect read and write command when enable replica-enable-redirect} { | ||
r config set replica-enable-redirect yes | ||
assert_error "MOVED -1 $master_host:$master_port" {r set foo bar} | ||
assert_error "MOVED -1 $master_host:$master_port" {r get foo} | ||
} | ||
|
||
test {non-data access commands are not redirected} { | ||
r ping | ||
} {PONG} | ||
|
||
test {replica allow read command in READONLY mode} { | ||
r readonly | ||
r get foo | ||
} {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters