Fix crash with CLUSTER REPLICATE for replicas with slots#12282
Fix crash with CLUSTER REPLICATE for replicas with slots#12282enjoy-binbin wants to merge 2 commits intoredis:unstablefrom
Conversation
In ac3850c, we allow replicas to switch master via CLUSTER REPLICATE, then modified the corresponding judgment, but forgot to modify clusterSetMaster. If a replica has slots, using the command will crash the replica. Fixes redis#12268
|
or maybe in CLUSTER REPLICATE, we should call a clusterDelNodeSlots(myself) if we find out myself is a replica. |
|
A replica in cluster should not possess any slot. I think we should forbid |
yeah, i agree with this. I checked it and didn't see any restrictions on replicas, and since the code been there forever, i plan to keep it for now. anyway, i am ok with both, let's see what other people say |
+1 |
Yeah, replicas are by design not supposed to own any slots. I would rather update the judgements to prevent the replica from trying to take ownership of slots. I'm fairly sure it was just an oversight at the time, the code has always been fairly fragile. |
we do this when master: now with the new changes, do we need to check the replicas? |
|
@madolson please take another look. IIUC it's not urgent, but there's probably no reason not to fix it one way or the other. |
|
|
In ac3850c, we allow replicas to switch master via CLUSTER REPLICATE.
If a replica has slots, using the command will crash the replica.
Replicas are by design not supposed to own any slots, in this PR, we update
the judgements to prevent the replica from trying to take ownership of slots.
Fixes #12268. Fixed #12717.