diff --git a/src/commands/command-docs.json b/src/commands/command-docs.json index 75df5b4c6..5e76c806c 100644 --- a/src/commands/command-docs.json +++ b/src/commands/command-docs.json @@ -91,6 +91,9 @@ }, { "const": "transactions" + }, + { + "const": "rate_limit" } ] }, diff --git a/src/server.h b/src/server.h index d7a6e4215..eaaf08b60 100644 --- a/src/server.h +++ b/src/server.h @@ -875,7 +875,15 @@ typedef enum { * - debug.c - xorObjectDigest, serverLogObjectDebugInfo * - defrag.c - defragKey * - module.c - RM_KeyType (and add the new keytype to redismodule.h) - * - object.c - object(create/free/dismiss/allocSize/Length) */ + * - object.c - object(create/free/dismiss/allocSize/Length) + * - tests/support/util.tcl:generate_fuzzy_traffic_on_key - add command(s) for the new object type to the `commands` dict. + * + * If the new object type requires new command group make sure to update the following: + * - src/commands/command-docs.json - update the group:oneOf map with the new group + * - utils/generate-command-code.py - add the new group to GROUPS and COMMAND_GROUP_STR arrays + * - src/acl.c - add the new group to ACLDefaultCommandCategories array + * - src/server.h - add the new group to redisCommandGroup enum + * - if needed add new KSN type related to the group - search for NOTIFY_* and REDISMODULE_NOTIFY_* defines. */ /* Extract encver / signature from a module type ID. */ #define REDISMODULE_TYPE_ENCVER_BITS 10 diff --git a/tests/integration/corrupt-dump-fuzzer.tcl b/tests/integration/corrupt-dump-fuzzer.tcl index a6d911324..e69a2221b 100644 --- a/tests/integration/corrupt-dump-fuzzer.tcl +++ b/tests/integration/corrupt-dump-fuzzer.tcl @@ -59,6 +59,7 @@ proc generate_types {} { # create other non-collection types r incr int r set string str + r gcra gcra 10 5 60000 # create bigger objects with 10 items (more than a single ziplist / listpack) generate_collections big 10 diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 16eb80008..6a011380f 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -800,7 +800,8 @@ proc generate_fuzzy_traffic_on_key {key type duration} { set set_commands {SADD SCARD SDIFF SDIFFSTORE SINTER SINTERSTORE SISMEMBER SMEMBERS SMOVE SPOP SRANDMEMBER SREM SSCAN SUNION SUNIONSTORE} set stream_commands {XACK XADD XCLAIM XDEL XGROUP XINFO XLEN XPENDING XRANGE XREAD XREADGROUP XREVRANGE XTRIM XDELEX XACKDEL XNACK} set vset_commands {VADD VREM} - set commands [dict create string $string_commands hash $hash_commands zset $zset_commands list $list_commands set $set_commands stream $stream_commands vectorset $vset_commands] + set gcra_commands {GCRA} + set commands [dict create string $string_commands hash $hash_commands zset $zset_commands list $list_commands set $set_commands stream $stream_commands vectorset $vset_commands gcra $gcra_commands] set cmds [dict get $commands $type] set start_time [clock seconds] diff --git a/tests/unit/gcra.tcl b/tests/unit/gcra.tcl index b012a0fc4..1080e76f7 100644 --- a/tests/unit/gcra.tcl +++ b/tests/unit/gcra.tcl @@ -227,6 +227,14 @@ start_server {tags {"gcra" "external:skip"}} { catch {r gcra mykey 1 1 2147483647 TOKENS 2147483647} err assert_match "*would cause an overflow*" $err } + + test {GCRASETVALUE - basic functionality} { + r del mykey + set tat_us [expr {[clock microseconds] + 60000000}] + assert_equal {OK} [r gcrasetvalue mykey $tat_us] + assert_equal {gcra} [r type mykey] + assert {[r pttl mykey] > 0} + } } start_server {tags {"gcra" "external:skip"}} {