
This commit fixes a well known and an annoying issue in Sentinel mode. Cause of this issue: Currently, Redis rewrite process works well in server mode, however in sentinel mode, the sentinel config has variant semantics for different configurations, in example configuration https://github.com/redis/redis/blob/unstable/sentinel.conf, we put comments on these. However the rewrite process only treat the sentinel config as a single option. During rewrite process, it will mess up with the lines and comments. Approaches: In order to solve this issue, we need to differentiate different subconfig options in sentinel separately, for example, sentinel monitor <master-name> <ip> <redis-port> <quorum> we can treat it as sentinel monitor option, instead of the sentinel option. This commit also fixes the dependency issue when putting configurations in sentinel.conf. For example before this commit,we must put `sentinel monitor <master-name> <ip> <redis-port> <quorum>` before `sentinel auth-pass <master-name> <password>` for a single master, otherwise the server cannot start and will return error. This commit fixes this issue, as long as the monitoring master was configured, no matter the sequence is, the sentinel can start and run properly.
18 lines
621 B
Tcl
18 lines
621 B
Tcl
test "(start-init) Flush config and compare rewrite config file lines" {
|
|
foreach_sentinel_id id {
|
|
assert_match "OK" [S $id SENTINEL FLUSHCONFIG]
|
|
set file1 ../tests/includes/sentinel.conf
|
|
set file2 [file join "sentinel_${id}" "sentinel.conf"]
|
|
set fh1 [open $file1 r]
|
|
set fh2 [open $file2 r]
|
|
while {[gets $fh1 line1]} {
|
|
if {[gets $fh2 line2]} {
|
|
assert [string equal $line1 $line2]
|
|
} else {
|
|
fail "sentinel config file rewrite sequence changed"
|
|
}
|
|
}
|
|
close $fh1
|
|
close $fh2
|
|
}
|
|
} |