RedisClusterException: Redis Cluster's master data is incomplete. Cluster is in invalid state. · Issue #2828 · phpredis/phpredis · GitHub
Skip to content

RedisClusterException: Redis Cluster's master data is incomplete. Cluster is in invalid state. #2828

@Mixno09

Description

@Mixno09

Description:
(Please note: English is not my native language, sorry for any mistakes.)

In a long-lived PHP process (e.g., Laravel Queue Worker), RedisCluster fails to update its slot map when a previously promoted Slave becomes a Master again. This leads to a persistent error state in the worker even after the cluster is healthy.

Steps to Reproduce:
State 1: Node-A (Master), Node-B (Slave). Worker: OK.
State 2: Node-A fails. Node-B is promoted to Master. Worker: OK.
State 3: Node-A returns as a Slave of Node-B. Worker: OK.
State 4: Node-B fails. Node-A is promoted back to Master.
Actual Result: Worker throws RedisClusterException: Redis Cluster's master data is incomplete. Cluster is in invalid state.
State 5: Node-A is Master, Node-B is Slave (Cluster is fully recovered and healthy).

Actual Result: The worker process continues to throw the exception and cannot recover the keyspace map.

Technical Details:
The exception is triggered in cluster_library.c during the slot update process:

redisClusterNode *prev_master = SLOT(c,c->redir_slot);
if (NULL == prev_master->slaves) {
    CLUSTER_THROW_EXCEPTION("Redis Cluster's master data is incomplete. Cluster is in invalid state.", 0);
    return FAILURE;
}

In State 4 and State 5, the prev_master->slaves pointer remains NULL in the worker's memory, causing the remap process to abort before the new topology can be applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions