Skip to content

Allow keyless commands to return MOVED response #2094

Open
@FedericaMarocco

Description

@FedericaMarocco

Valkey Search module introduces new commands (FT.CREATE , FT.SEARCH, and others) that operate on indexes instead of keys (see commands). Indexes are global, and Valkey search provides the required machinery to distribute the index metadata to all nodes in the cluster, and collect query results from all nodes. The Search module commands are currently decorated with command flags write and readonly (see module loader).

However, since these commands are not associated to keys, they don’t automatically return a MOVED response when executed on replica nodes in cluster-mode enabled Valkey clusters. I opened 2 issues in Valkey Search repo to report this issue for FT.SEARCH (and other readonly commands) and FT.CREATE (and other write commands). Here is an example of the FT.CREATE command behavior:

Current behavior:

127.0.0.1:6379> FT.CREATE json_idx1 ON JSON PREFIX 1 json: SCHEMA $.vec AS VEC VECTOR HNSW 6 DIM 2 TYPE FLOAT32 DISTANCE_METRIC L2
(error) READONLY You can't write against a read only replica

Expected behavior

127.0.0.1:6379> FT.CREATE json_idx1 ON JSON PREFIX 1 json: SCHEMA $.vec AS VEC VECTOR HNSW 6 DIM 2 TYPE FLOAT32 DISTANCE_METRIC L2
(error) MOVED <hash slot> <primary node ip:port>

Since this behavior is controlled by the Valkey core, Valkey Search module would require new functionality (for example additional command flags) to enable command routing via MOVED response for keyless commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    client-changes-neededClient changes may be required for this feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions