DEBUG

Since 1.1.0ServerChanged in 1.2.1

Syntax

DEBUG ...
  • Flags: admin
  • ACL categories: @admin, @dangerous, @slow
  • Arity: -2

History

  • 1.2.1: acl categories: removed server

For tests and tools written for Redis. The subcommands, each with a page of its own:

  • DEBUG SLEEP seconds: the thread that runs it sleeps that long, which holds up the clients that share it; useful for testing timeouts.
  • DEBUG POPULATE count [prefix] [size]: makes count string keys, prefix:0 onwards (key:0 without a prefix), holding value:0 onwards, cut or padded with zero bytes to size bytes when one is given. A key that is there already is left as it is. Before 1.2, it replied OK and made nothing.
  • DEBUG PROTOCOL type: replies with a value of that type (string, integer, double, bignum, null, array, set, map, ...), for testing a client's RESP3 support.
  • DEBUG DIGEST-VALUE key [key ...]: for each key, a digest of its value in 40 hex digits, or 40 zeros for a key that is not there, as in Redis. redis-cli --cluster fix compares the copies of a key it finds on two nodes with it. New in 1.2; before, it replied OK.
  • DEBUG OBJECT key: the key's encoding, serialized length and last use, in Redis's form.
  • DEBUG LOG message: writes message to the server's log.
  • DEBUG PAUSE-CRON 0|1 and DEBUG SET-ACTIVE-EXPIRE 0|1: pause and resume the background expiry.
  • DEBUG SET-DISABLE-DENY-SCRIPTS 0|1: accepted, and changes nothing.
  • DEBUG HELP: lists them.

Any other subcommand, Redis's RELOAD, LOADAOF and CHANGE-REPL-ID among them, or one with the wrong number of arguments, is refused with Redis's ERR unknown subcommand or wrong number of arguments for '<name>'. Try DEBUG HELP..

Since 1.2.1. In 1.2.0, DEBUG OBJECT replied with a fixed line, whatever the key, and every other subcommand, HELP, LOG, PAUSE-CRON, SET-ACTIVE-EXPIRE and RELOAD among them, replied OK and did nothing. A test suite that relied on DEBUG RELOAD replying OK now gets the error.

Examples

> DEBUG POPULATE 2
OK
> GET key:0
"value:0"
> DEBUG POPULATE 1 p 12
OK
> STRLEN p:0
(integer) 12

Subcommands

  • DEBUG DIGEST-VALUE: For each key, a digest of its value in 40 hexadecimal digits, or 40 zeros for a key that is not there, as in Redis.
  • DEBUG HELP: Lists the DEBUG subcommands, with a line on what each does, as Redis does.
  • DEBUG LOG: Writes message to the server's log, at the WARN level, as DEBUG LOG: <message>.
  • DEBUG OBJECT: Describes the value at key in Redis's form: its encoding, the length of its serialized form and when it was last used.
  • DEBUG PAUSE-CRON: DEBUG PAUSE-CRON 1 pauses the background expiry, of keys and hash fields, and DEBUG PAUSE-CRON 0 resumes it, as Redis's pauses its cron, where that expiry runs.
  • DEBUG POPULATE: Makes count string keys, prefix:0, prefix:1 and on (key:0 and on without a prefix), holding value:0, value:1 and on, cut or padded with zero bytes to size bytes when size is given.
  • DEBUG PROTOCOL: Replies with a value of the RESP type named: string, integer, double, bignum, null, array, set, map, attrib, push, verbatim, true or false.
  • DEBUG SET-ACTIVE-EXPIRE: DEBUG SET-ACTIVE-EXPIRE 0 stops the background expiry of keys and hash fields, and DEBUG SET-ACTIVE-EXPIRE 1 starts it again.
  • DEBUG SET-DISABLE-DENY-SCRIPTS: Accepted, for Redis's test suite, and changes nothing: replies OK for 0 or 1.
  • DEBUG SLEEP: Makes the worker thread that runs it sleep for seconds, which can have a fraction, such as 0.5.