Skip to content

Fix replica left as a sub-replica after a failover - #486

Merged
takenliu merged 1 commit into
Tencent:2.8.txfrom
takenliu:branch2
Oct 26, 2026
Merged

takenliu merged 1 commit into
Tencent:2.8.txfrom
takenliu:branch2

Conversation

@takenliu

@takenliu takenliu commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

#485
假设主从关系是:A1->A2, A1->A3,对A3执行cluster failover提主后,期望主从关系变成A3->A1,A3->A2。
但是当前代码可能出现下面的错误情况:A3->A1->A2,A2节点依旧挂在A1后面,没有挂到A3后面去。
出现的前提是:
A2先收到A1变从的消息,后收到A3持有slots的信息。
出错的原因是:
A2先收到A1变从的消息时,执行clusterDelNodeSlots。然后收到A3持有slots的信息,在执行clusterUpdateSlotsConfigWith时,_allSlots[j]和curmaster对不上,所以不会进行切换主节点。

特别是 #482 这个修复之后,会在旧主A1降级为从时立刻广播pong,从而更容易触发“A2先收到A1变从的消息,后收到A3持有slots的信息。”

Description

Motivation and Context

How Has This Been Tested?

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • Code follows the code style of this project.
  • Change requires a change to the documentation.
  • I have updated the documentation accordingly.

@takenliu
takenliu merged commit c4fba6e into Tencent:2.8.tx Oct 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant