Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
|
梳理了一下 记录里提到的方式有2种: 2 在RocksDB里定时插入一对kv,记录当前binlog最新的offset,当崩溃以后,查RocksDB来得到redo开始的binlog offset 背景:Pika的binlog不具备幂等性,同一条binlog如果被重放/消费多次,可能影响数据库正确性,比如rpop list_xxx这种,不同于set k1 v1。后者执行多次数据依旧正确,但前者如果执行多次,数据就出错了 其他可能: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
核心对话
denghao
我发现社区版的pika是同步binlog 但是可以关wal,这么说如果把binlog offset存一下 进程崩了是不是可以用binlog来恢复memtable的那一部分数据。我感觉解法还是关wal可能靠谱点。
Korpse
正好看过有篇论文讲的是怎么安全去掉 MyRocks 中的 wal,只保留 binlog,论文链接,中文讲解
大致来说就是每次 memtable 刷盘的时候,插入一对 kv 用作标记,标记里面存了 binlog 的 offset。恢复的时候就能知道需要从 binlog 的哪个位置开始重放了(后续称这个标记为 flag)
cheniujh
解决的问题是:当崩溃了,binlog应该从哪里开始读是嘛?
Korpse
对的,如果不记录这个标记,只能把binlog全部重放一次
完整记录
Beta Was this translation helpful? Give feedback.
All reactions