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中一次操作flushdb等管理命令,有写性质的命令,由于binlog处理不当,可能引起主从不一致 #2526

Open
Mixficsol opened this issue Mar 18, 2024 · 1 comment
Labels
☢️ Bug Something isn't working

Comments

@Mixficsol
Copy link
Collaborator

Mixficsol commented Mar 18, 2024

Description

#1638 记俊华之前修复的主从同步不一致的问题,之前解决的是对于操作多个key的命令,如果只根据第一个KeyHash 到不同的 Worker 线程的话可能会导致主从数据不一致的情况,后面经过把多 KeyBinlog 进行了拆分解决了这个问题,今天在测试主从同步的过程中发现,FlushDB 这种管理命令如果和 Set key value 在一起执行的话,顺序是不能保证的,举个例子:比如主节点顺序执行了 Set a bSet a cFlushdb,然后从节点那边 Set a bSet a c 肯定是 Hash 到同一个线程里面执行的,但是 Flushdb 这个命令大概率不会 HashSet a b这个线程里面,如果此时 FlushDB 的这个线程优先执行完,那么从节点写 DB 的顺序就会变为 FlushDB -> Set a b -> Set a c,与主节点那边不一致。可能的一个改进办法是,在从节点端把写 DB 这个行为改为同步的,和写 Binlog 一致即可保证命令的顺序性。

@Mixficsol Mixficsol added the ☢️ Bug Something isn't working label Mar 18, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Master-slave synchronization to be repaired] A management command such as flushdb is operated in pika. There are write commands. Due to improper binlog processing, master-slave inconsistency may occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️ Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants