Skip to content
4 changes: 2 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3437,8 +3437,8 @@ standardConfig static_configs[] = {
createLongLongConfig("cluster-node-timeout", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.cluster_node_timeout, 15000, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("cluster-ping-interval", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, LLONG_MAX, server.cluster_ping_interval, 0, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("commandlog-execution-slower-than", "slowlog-log-slower-than", MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_SLOW].threshold, 10000, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("commandlog-request-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].threshold, 1024 * 1024, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("commandlog-reply-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold, 1024 * 1024, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("commandlog-request-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].threshold, 1024 * 1024, MEMORY_CONFIG | SIGNED_MEMORY_CONFIG, NULL, NULL),
createLongLongConfig("commandlog-reply-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold, 1024 * 1024, MEMORY_CONFIG | SIGNED_MEMORY_CONFIG, NULL, NULL),
createLongLongConfig("latency-monitor-threshold", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.latency_monitor_threshold, 0, INTEGER_CONFIG, NULL, NULL),
createLongLongConfig("proto-max-bulk-len", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 1024 * 1024, LONG_MAX, server.proto_max_bulk_len, 512ll * 1024 * 1024, MEMORY_CONFIG, NULL, NULL), /* Bulk request max size */
createLongLongConfig("stream-node-max-entries", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.stream_node_max_entries, 100, INTEGER_CONFIG, NULL, NULL),
Expand Down
36 changes: 36 additions & 0 deletions tests/unit/commandlog.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -408,4 +408,40 @@ start_server {tags {"commandlog"} overrides {commandlog-execution-slower-than 10
r config set min-string-size-avoid-copy-reply $copy_avoid
r del testkey
}

test {COMMANDLOG - memory config with set / get / rewrite} {
r config set commandlog-request-larger-than 10mb
r config set commandlog-reply-larger-than 10mb
assert_equal [r config get commandlog-request-larger-than] {commandlog-request-larger-than 10485760}
assert_equal [r config get commandlog-reply-larger-than] {commandlog-reply-larger-than 10485760}

r config rewrite
restart_server 0 true false
assert_equal [lindex [r config get commandlog-request-larger-than] 1] 10485760
assert_equal [lindex [r config get commandlog-reply-larger-than] 1] 10485760
}

test {COMMANDLOG - special number -1 disables the command logging} {
r config set commandlog-execution-slower-than -1
r config set commandlog-request-larger-than -1
r config set commandlog-reply-larger-than -1
assert_error {*argument must be between -1 and *} {r config set commandlog-execution-slower-than -2}
assert_error {*argument must be between -1 and *} {r config set commandlog-request-larger-than -2}
assert_error {*argument must be between -1 and *} {r config set commandlog-reply-larger-than -2}

r commandlog reset slow
r commandlog reset large-request
r commandlog reset large-reply

r ping
assert_equal [r commandlog len slow] 0
assert_equal [r commandlog len large-request] 0
assert_equal [r commandlog len large-reply] 0

r config rewrite
restart_server 0 true false
assert_equal [lindex [r config get commandlog-execution-slower-than] 1] -1
assert_equal [lindex [r config get commandlog-request-larger-than] 1] -1
assert_equal [lindex [r config get commandlog-reply-larger-than] 1] -1
}
}
Loading