Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pika slaveof 命令返回值改进 #1965

Closed
Mixficsol opened this issue Sep 8, 2023 · 1 comment
Closed

Pika slaveof 命令返回值改进 #1965

Mixficsol opened this issue Sep 8, 2023 · 1 comment

Comments

@Mixficsol
Copy link
Collaborator

Mixficsol commented Sep 8, 2023

Describe the bug

目前 Pika 的主从复制过程中,如果一个集群的从节点 slaveof 另一个集群的主节点,执行 slaveof 命令时会返回 OK,但是数据不能进行同步,因为在执行 slaveof ip port 之前没有先进行 slaveof no one,但是这种情况执行 slaveof 命令应该不能返回 OK 的,由于 Pika 进行主从同步时发送的 metasync 请求是一个异步线程进行处理的,所以应该怎么进行改进?

To Reproduce

你可以搭建两个 Pika 集群, 都是一主一从,然后用一个集群的从节点 slaveof 另一个集群的主节点,目前的返回值应该是 OK,但是执行 info replication 的时候会显示数据未同步

Expected behavior

我们希望在进行非正常情况下执行的 slaveof 命令能返回对应的值报错,而不是返回 OK 但是数据不同步误导用户,目前列举以下几种情况是非正常情况的 slaveof:(前提都没有进行slaveof no one 操作)

  1. 一个集群的从节点 slaveof 另一个集群的从节点
  2. 一个集群的从节点 slaveof 另一个集群的主节点
  3. 两个节点的 replicationID 非空且不一致,双方 slaveof

Screenshots

截屏2023-09-08 10 36 12

Additional context

如果你有好的想法,欢迎在下面留言

@AlexStocks
Copy link
Collaborator

@chenshixin

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

No branches or pull requests

2 participants