Enable debug asserts for cluster and sentinel tests (#588)

Also make `enable-debug-assert` an immutable config

Address review comments in #584

---------

Signed-off-by: Ping Xie <pingxie@google.com>
This commit is contained in:
Ping Xie 2024-06-02 13:15:08 -07:00 committed by GitHub
parent d16b4ec1b9
commit 30f277a86d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ redis.code-workspace
.cache
.cscope*
.swp
tests/cluster/tmp/*

View File

@ -3054,6 +3054,7 @@ standardConfig static_configs[] = {
createBoolConfig("aof-disable-auto-gc", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.aof_disable_auto_gc, 0, NULL, updateAofAutoGCEnabled),
createBoolConfig("replica-ignore-disk-write-errors", NULL, MODIFIABLE_CONFIG, server.repl_ignore_disk_write_error, 0, NULL, NULL),
createBoolConfig("extended-redis-compatibility", NULL, MODIFIABLE_CONFIG, server.extended_redis_compat, 0, NULL, updateExtendedRedisCompat),
createBoolConfig("enable-debug-assert", NULL, IMMUTABLE_CONFIG | HIDDEN_CONFIG, server.enable_debug_assert, 0, NULL, NULL),
/* String Configs */
createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.acl_filename, "", NULL, NULL),
@ -3191,7 +3192,6 @@ standardConfig static_configs[] = {
createTimeTConfig("repl-backlog-ttl", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.repl_backlog_time_limit, 60 * 60, INTEGER_CONFIG, NULL, NULL), /* Default: 1 hour */
createOffTConfig("auto-aof-rewrite-min-size", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.aof_rewrite_min_size, 64 * 1024 * 1024, MEMORY_CONFIG, NULL, NULL),
createOffTConfig("loading-process-events-interval-bytes", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 1024, INT_MAX, server.loading_process_events_interval_bytes, 1024 * 1024 * 2, INTEGER_CONFIG, NULL, NULL),
createBoolConfig("enable-debug-assert", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.enable_debug_assert, 0, NULL, NULL),
/* Tls configs */
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.tls_port, 0, INTEGER_CONFIG, NULL, applyTLSPort), /* TCP port. */

View File

@ -647,10 +647,7 @@ robj *tryObjectEncodingEx(robj *o, int try_trim) {
* Note that we avoid using shared integers when maxmemory is used
* because every object needs to have a private LRU field for the LRU
* algorithm to work well. */
if (canUseSharedObject() &&
value >= 0 &&
value < OBJ_SHARED_INTEGERS)
{
if (canUseSharedObject() && value >= 0 && value < OBJ_SHARED_INTEGERS) {
decrRefCount(o);
return shared.integers[value];
} else {

View File

@ -701,10 +701,11 @@ typedef enum {
#define serverAssert(_e) (likely(_e) ? (void)0 : (_serverAssert(#_e, __FILE__, __LINE__), valkey_unreachable()))
#define serverPanic(...) _serverPanic(__FILE__, __LINE__, __VA_ARGS__), valkey_unreachable()
/* The following macro provides a conditional assertion that is only executed
/* The following macros provide a conditional assertion that is only executed
* when the server config 'enable-debug-assert' is true. This is useful for adding
* assertions that are too computationally expensive or risky to run in normal
* operation, but are valuable for debugging or testing. */
#define debugServerAssert(...) (server.enable_debug_assert ? serverAssert(__VA_ARGS__) : (void)0)
#define debugServerAssertWithInfo(...) (server.enable_debug_assert ? serverAssertWithInfo(__VA_ARGS__) : (void)0)
/* latency histogram per command init settings */

View File

@ -118,6 +118,8 @@ proc spawn_instance {type base_port count {conf {}} {base_conf_file ""}} {
puts $cfg "repl-diskless-sync-delay 0"
puts $cfg "dir ./$dirname"
puts $cfg "logfile log.txt"
puts $cfg "enable-debug-assert yes"
# Add additional config files
foreach directive $conf {
puts $cfg $directive