dragonflydb / dragonflydb/dragonfly

Cluster fix READWRITE command

Open
#4,728 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
31.5k
Forks
1.3k
Avg merge
1d 10h
Merged PRs (30d)
137

Description

Problem: The replica knows nothing about the cluster and always works in read-only mode. It means we can read from the replica all the data but don't get a -MOVE error if we try to write something.

Expected behavior: In READONLY mode we return -MOVE if we don't have the key or for any WRITE command. In READWRITE mode we return -MOVE error for any READ/WRITE commands

If we want to support this we will need to save in connection cntx a boolean set it if readonly command was invaded, and on cluster mode before invoking transaction read commands we need to check if this flag was set.
Where to start:
Service::VerifyCommandState() and IsUserAllowedToInvokeCommandGeneric

add
```
if (!IsClusterEmulated()) {
return cmd_cntx.rb->SendError(kClusterDisabled);
```

Contributor guide

Open the contributing guide

Research direction

Start with Service::VerifyCommandState() and IsUserAllowedToInvokeCommandGeneric, then trace the connection context and cluster-mode command checks. Confirm the READONLY and READWRITE behaviors described in the issue, including the -MOVE responses, and verify the cluster-disabled path shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.