diff --git a/src/config.cpp b/src/config.cpp index 50c08d9ed..749fb5746 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -2724,6 +2724,14 @@ static int isValidProcTitleTemplate(char *val, const char **err) { return 1; } +static int isValidDisklessEnum(int e, const char **err) { + if (e == REPL_DISKLESS_LOAD_SWAPDB && g_pserver->m_pstorageFactory != nullptr) { + *err = "cannot use swapdb with a storage provider"; + return 0; + } + return 1; +} + static int updateProcTitleTemplate(char *val, char *prev, const char **err) { UNUSED(val); UNUSED(prev); @@ -3091,7 +3099,7 @@ standardConfig configs[] = { /* Enum Configs */ createEnumConfig("supervised", NULL, IMMUTABLE_CONFIG, supervised_mode_enum, cserver.supervised_mode, SUPERVISED_NONE, NULL, NULL), createEnumConfig("syslog-facility", NULL, IMMUTABLE_CONFIG, syslog_facility_enum, g_pserver->syslog_facility, LOG_LOCAL0, NULL, NULL), - createEnumConfig("repl-diskless-load", NULL, MODIFIABLE_CONFIG, repl_diskless_load_enum, g_pserver->repl_diskless_load, REPL_DISKLESS_LOAD_DISABLED, NULL, NULL), + createEnumConfig("repl-diskless-load", NULL, MODIFIABLE_CONFIG, repl_diskless_load_enum, g_pserver->repl_diskless_load, REPL_DISKLESS_LOAD_DISABLED, isValidDisklessEnum, NULL), createEnumConfig("loglevel", NULL, MODIFIABLE_CONFIG, loglevel_enum, cserver.verbosity, LL_NOTICE, NULL, NULL), createEnumConfig("maxmemory-policy", NULL, MODIFIABLE_CONFIG, maxmemory_policy_enum, g_pserver->maxmemory_policy, MAXMEMORY_NO_EVICTION, NULL, NULL), createEnumConfig("appendfsync", NULL, MODIFIABLE_CONFIG, aof_fsync_enum, g_pserver->aof_fsync, AOF_FSYNC_EVERYSEC, NULL, NULL), diff --git a/tests/integration/replication-psync-flash.tcl b/tests/integration/replication-psync-flash.tcl index e57ccea0e..353c02614 100644 --- a/tests/integration/replication-psync-flash.tcl +++ b/tests/integration/replication-psync-flash.tcl @@ -114,6 +114,10 @@ if {$::flash_enabled} { foreach mdl {no yes} { foreach sdl {disabled swapdb} { + if {$::flash_enabled && $sdl == "swapdb"} { + continue + } + test_psync {no reconnection, just sync} 6 1000000 3600 0 { } $mdl $sdl 0 diff --git a/tests/integration/replication-psync-multimaster.tcl b/tests/integration/replication-psync-multimaster.tcl index ada3f8cec..a905dfae4 100644 --- a/tests/integration/replication-psync-multimaster.tcl +++ b/tests/integration/replication-psync-multimaster.tcl @@ -128,6 +128,10 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl reco foreach mdl {no yes} { foreach sdl {disabled swapdb} { + if {$::flash_enabled && $sdl == "swapdb"} { + continue + } + test_psync {no reconnection, just sync} 6 1000000 3600 0 { } $mdl $sdl 0 diff --git a/tests/integration/replication-psync.tcl b/tests/integration/replication-psync.tcl index 08e21d310..4d108aa30 100644 --- a/tests/integration/replication-psync.tcl +++ b/tests/integration/replication-psync.tcl @@ -119,6 +119,10 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl reco foreach mdl {no yes} { foreach sdl {disabled swapdb} { + if {$::flash_enabled && $sdl == "swapdb"} { + continue + } + test_psync {no reconnection, just sync} 6 1000000 3600 0 { } $mdl $sdl 0 diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl index fa84ac9d5..d80c25884 100644 --- a/tests/integration/replication.tcl +++ b/tests/integration/replication.tcl @@ -252,6 +252,10 @@ start_server {tags {"repl"}} { foreach mdl {no yes} { foreach sdl {disabled swapdb} { + if {$::flash_enabled && $sdl == "swapdb"} { + # swapdb not compatible with flash + continue + } start_server {tags {"repl"}} { set master [srv 0 client] $master config set repl-diskless-sync $mdl @@ -383,6 +387,7 @@ start_server {tags {"repl"}} { } } +if {!$::flash_enabled} { test {slave fails full sync and diskless load swapdb recovers it} { start_server {tags {"repl"}} { set slave [srv 0 client] @@ -547,6 +552,7 @@ test {diskless loading short read} { } } } +} # get current stime and utime metrics for a thread (since it's creation) proc get_cpu_metrics { statfile } { @@ -578,7 +584,7 @@ proc compute_cpu_usage {start end} { return [ list $pucpu $pscpu ] } - +if {!$::flash_enabled} { # test diskless rdb pipe with multiple replicas, which may drop half way start_server {tags {"repl"}} { set master [srv 0 client] @@ -814,6 +820,7 @@ test "diskless replication read pipe cleanup" { } } } +} test {replicaof right after disconnection} { # this is a rare race condition that was reproduced sporadically by the psync2 unit.