提交 a1349728 编写于 作者: A antirez

Cluster: on resharding upgrade version of receiving node.

The node receiving the hash slot needs to have a version that wins over
the other versions in order to force the ownership of the slot.

However the current code is far from perfect since a failover can happen
during the manual resharding. The fix is a work in progress but the
bottom line is that the new version must either be voted as usually,
set by redis-trib manually after it makes sure can't be used by other
nodes, or reserved configEpochs could be used for manual operations (for
example odd versions could be never used by slaves and are always used
by CLUSTER SETSLOT NODE).
上级 6dc26795
......@@ -3169,11 +3169,15 @@ void clusterCommand(redisClient *c) {
clusterNode *old_owner =
server.cluster->importing_slots_from[slot];
/* This slot was manually migrated, set this node configEpoch
* at least to the value of the configEpoch of the old owner
* so that its old replicas, or some of its old message pending
* on the cluster bus, can't claim our slot. */
* to a new epoch so that the new version can be propagated
* by the cluster.
*
* FIXME: the new version should be agreed otherwise a race
* is possible if while a manual resharding is in progress
* the master is failed over by a slave. */
if (old_owner->configEpoch > myself->configEpoch) {
myself->configEpoch = old_owner->configEpoch;
server.cluster->currentEpoch++;
myself->configEpoch = server.cluster->currentEpoch;
clusterDoBeforeSleep(CLUSTER_TODO_FSYNC_CONFIG);
}
server.cluster->importing_slots_from[slot] = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册