KeyDB icon indicating copy to clipboard operation
KeyDB copied to clipboard

[BUG] Command 'KEYS *' returns '(empty array)' even though there are keys on the server

Open shcorya opened this issue 2 years ago • 2 comments

Describe the bug

I have three KeyDB servers each running in active-replica mode, each of the three connected to the other two, confrimed by the ROLE command and logs.

keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.103 * Starting BGSAVE for SYNC with target: replicas sockets
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.105 * Background RDB transfer started by pid 54
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 54:24:C 20 Jul 2023 15:23:21.126 * RDB: 0 MB of memory used by copy-on-write
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.138 # Diskless rdb transfer, done reading from pipe, 2 replicas still up.
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.143 * Background RDB transfer terminated with success
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.144 * Streamed RDB transfer with replica 10.0.2.72:6379 succeeded (socket). Waiting for REPLCONF ACK from slave to enable streaming
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.144 * Streamed RDB transfer with replica 10.0.2.73:6379 succeeded (socket). Waiting for REPLCONF ACK from slave to enable streaming
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.144 * Synchronization with replica 10.0.2.72:6379 succeeded
keyes_keyes.3.8h0vfdqoprnn@us-chi-021-05    | 13:24:S 20 Jul 2023 15:23:21.183 * Synchronization with replica 10.0.2.73:6379 succeeded

On two of the servers, when I run the command KEYS *, all of my test keys (each starting with key) e.g. key1, key2, key3 etc. are returned. On the third server, when I run KEYS *, it returns (empty array); however, when I run KEYS key* (again on the third server), it returns all my test keys.

To reproduce

Connect three nodes, each to one another, and run the command KEYS * on each node. This issue started happening after a while, not immediately on the connection.

Expected behavior

I expect the command KEYS * to return all keys, including those prefixed with key.

Additional information

Running KEYS "*" with the asterisk in quotation marks returns all keys.

shcorya avatar Jul 20 '23 15:07 shcorya

just a question, when KEYS * is failing, does SCAN work and retrieve the keys as expected?

mbfdias avatar Dec 02 '23 04:12 mbfdias

I have not been able to replicate this issue since I first posted it.

shcorya avatar Jan 24 '24 18:01 shcorya