C100DBA MongoDB 讲解 replica set vote
题目中文:
Given a replica set with five data-bearing members, suppose the primary goes down with operations in its oplog that have been copied to only one secondary .
Assuming no other problems occur, which of the following describes what is most likely to happen?
- The primary will rollback the operations
- The secondary with the most recent oplog will be elected primary
- The most recent secondary will roll back the operations following the election
- Reads will stale until primary comes backup up
翻译:
对于一个有五个承载数据的成员的replica set 而言,假设primary服务器宕机了,且其oplog中最新的操作信息只成功拷贝到一个secondary上了。
假设没有其他问题发生,以下哪个选项是正确的?
- Primary将在恢复时回滚部分操作
- 拥有最新的oplog的这个secondary服务器将赢得election并成为primary
- 在election后最新的这个secondary会回滚部分操作
- 直到primary重新可用,之前读操作将读到过时的数据
关于此问题 官方文档有较明确解释:
A rollback does not occur if the write operations replicate to another member of the replica set before the primary steps down and if that member remains available and accessible to a majority of the replica set. http://docs.mongodb.org/manual/core/replica-set-rollbacks/
只要primary上的写操作已经复制到某个secondary成员上,secondary成员可用,就可以保证rollback不会发生。
Comment