故障案例--mongodb writeconcern为majority时的又一个bug
来源:互联网 发布:淘宝点卡类宝贝发布 编辑:程序博客网 时间:2024/06/05 09:45
前言
之前的文章有提到过majority的一个坑,还谈不上bug,链接如下点击打开链接
故障现象
majority下应用层一直报错,但实际数据写入成功,包括主从节点都成功;w设置为1以后没有报错,写入成功
044dd16e-7706-4a49-b4ff-73d86a99d6fd:PRIMARY> db.getWriteConcern()
WriteConcern({ "w" : "majority", "wtimeout" : 3000 })
044dd16e-7706-4a49-b4ff-73d86a99d6fd:PRIMARY> db.things.insert({name:"123"})
WriteResult({
"nInserted" : 1,
"writeConcernError" : {
"code" : 64,
"errInfo" : {
"wtimeout" : true
},
"errmsg" : "waiting for replication timed out"
}
})
044dd16e-7706-4a49-b4ff-73d86a99d6fd:PRIMARY> db.getWriteConcern()
WriteConcern({ "w" : 1, "wtimeout" : 3000, "j" : true })
044dd16e-7706-4a49-b4ff-73d86a99d6fd:PRIMARY> db.things.insert({dingshun:"123"})
WriteResult({ "nInserted" : 1 })
故障原因
查了下主库的mongod日志,看到有这么几条信息,怀疑是bug引起
查了下官网,确实是个低版本的bug,我的db版本正好是2.6.1 链接 https://jira.mongodb.org/browse/SERVER-15849
ISSUE SUMMARY
On a replicaset that uses chained replication, if a secondary with id M that syncs from secondary with id N is removed, node N continues to forward replication information about M to the primary.
USER IMPACT
The following message appears repeatedly in the primary's logfile:
replset couldn't find a slave with id M
If the removed node is required to meet a specific write concern, write operations with that write concern will wait indefintely unless a wtimeout was specified.
On a sharded cluster, during a chunk migration the destination shard will wait for the final writes to be replicated to the majority of the nodes. If the write concern cannot be satisfied and awtimeout was not specified, the chunk migration times out after 60 minutes.
WORKAROUNDS
There is no workaround for this issue.
AFFECTED VERSIONS
MongoDB 2.6 versions up to 2.6.5 are affected by this issue.
FIX VERSION
The fix is included in the 2.6.6 production release.
RESOLUTION DETAILS
Secondaries no longer forward replication progress for nodes that are no longer part of a replica set
2.6.6版本以后修复
解决方法
重启所有的节点使得重新刷新内部缓存数据,或者升级到高版本,建议升级版本;
另外一种方法我没试,猜测或许可行,就是简单地把rs.config中的_id列重新改为顺序的 1,2,3...杜绝不连续的id值
- 故障案例--mongodb writeconcern为majority时的又一个bug
- 故障案例--mongodb副本集write concern为majority的一个坑
- MongoDB的WriteConcern 参数详解
- MongoDB WriteConcern
- 故障案例--在线ddl的一个bug
- .Text 的又一个 Bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- NetBeans的又一个bug
- 又一个amfext的bug
- 又一个碉堡的BUG
- Android应用开发性能优化完全分析
- css 命名规范
- idea搭建SSM框架遇到的问题
- linux数据盘,系统盘
- W32汇编窗口程序
- 故障案例--mongodb writeconcern为majority时的又一个bug
- Qt 槽机制:public slots 和 private slots
- 反向传播网络(BP 网络)
- nginx基本配置与参数说明
- Remove Nth Node From End of List
- Oracle 查询及高级查询
- 用 document.readyState == "complete" 判断页面是否加载完成
- maxnewsize不轻易加
- Paxos-->Fast Paxos-->Zookeeper分析