Skip to content

ZDIFF command discrepancies #5920

@michael-grunder

Description

@michael-grunder

Describe the bug

  1. ZDIFF ignores the WITHSCORES argument if it is not sent in all caps.
  2. Dragonfly's ZDIFF WITHSCORES reply is structurally different from Redis'

To Reproduce
Steps to reproduce the behavior:

  1. Add an entry to a zset
  2. Run ZDIFF withscores (withscores must not be all-caps)
  3. Run ZDIFF WITHSCORES in RESP3 mode

Expected behavior

  1. The WITHSCORES argument to be case insensitive.
  2. The ZDIFF WITHSCORES reply is structured the same way as Redis does in RESP3 mode.

Environment (please complete the following information):

  • OS: Debian GNU/Linux forky/sid x86_64
  • Kernel: # Command: Linux hydra 6.1.0-29-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.123-1 (2025-01-02) x86_64 GNU/Linux
  • Containerized?: Bare metal, dragonfly db in a container
  • Dragonfly Version: df-dev (a4ee2d5)

Reproducible Code Snippet

  1. To demonstrate WITHSCORES is case sensitive:
redis-cli -3 zadd zs 1 one
redis-cli -3 echo "no scores"
redis-cli -3 zdiff 1 zs withscores
redis-cli -3 echo "with scores"
redis-cli -3 zdiff 1 zs WITHSCORES
  1. Demonstrating the replies structural difference:

Redis:

# In my case Redis is on port 6382
redis-cli zadd zs 1 one && redis-cli -p 6382 -3 zdiff 1 zs withscores
(integer) 0
1) 1) "one"
   2) (double) 1

Dragonfly:

❯ redis-cli zadd zs 1 one && redis-cli -3 zdiff 1 zs WITHSCORES
(integer) 0
1) "one"
2) (double) 1

Additional context
I'm guessing the case-sensitive issue is here:

const bool with_scores = ArgS(args, args.size() - 1) == "WITHSCORES";

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions