Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Inconsistent SETBIT: integer value corresponding to a key cannot be updated using SETBIT in certain situations #1115

Closed
@Yashasv-Prajapati

Description

@Yashasv-Prajapati

Steps to reproduce

  1. Start the dicedb server and connect to it through whatever client(redis-cli or something else) you prefer.
  2. Run the following commands in sequence.
    a. SET <key> 10
    b. SETBIT <key> 1 1
    c. SETBIT <key> 3 0

Expected output

The expected output when the above set of commands (maybe when run on Redis) should be the previously set bit on that offset.

For A -> (integer) 0 -> Previous bit at this position
For B -> (integer) 1 -> Previous bit at this position

Observed output

The observed output when the above set of commands when run on DiceDB

For A -> (error) WRONGTYPE Operation against a key holding the wrong kind of value
For B -> (error) WRONGTYPE Operation against a key holding the wrong kind of value

Also, if you try to set the same bit as the previous bit at that offset, it seems to be working fine without any error. Like the following command.

SETBIT <key> 1 0 -> Command A
SETBIT <key> 3 1 -> Command B

Expectations for resolution

This issue will be considered resolved when the following things are done

  1. Changes in the dice code to meet the expected behavior
  2. Addition of relevant test case to ensure we catch the regression

You can find the tests under the integration_tests directory of the dice repository and the steps to run are in the README file. Refer to the following links to set up DiceDB and Redis 7.2.5 locally

Follow up

Once this is completed, drop a comment in issue #813 regarding the same.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions