MongoDB DBA · 题目 524 · 多选

43. Consider the following write operation issued against a 3-node replica set: db.products.update( { "name": "laptop", "price_USD": NumberDecimal(800) }, { "$inc": { "quantity": 1 } }, { "w": 3 } ) This write operation is very slow and blocks other operations on the client. Which of the following operations will mitigate any potential blocking of other operations in the client? Check all that apply:

题目选项

  1. A.
    db.products.update( { "name": "laptop", "price_USD": NumberDecimal(800) }, { "$inc": { "quantity": 1 } }, { "w": 2 } )
  2. B.
    db.products.update( { "name": "laptop", "price_USD": NumberDecimal(800) }, { "$inc": { "quantity": 1 } }, { "w": 3, "wtimeout": 4500 } )
  3. C.
    db.products.update( { "name": "laptop", "price_USD": NumberDecimal(800) }, { "$inc": { "quantity": 1 } }, { "w": 4 } )

答案置信度:中

正确答案:A、B

解析语言:中文

阻塞的根源是这条写要等到 w:3(三个节点全部确认)才返回。把 w 降为 2 只需多数确认即可返回,等待时间明显缩短,A 有效;保持 w:3 但补上 wtimeout 则保证超时后不再阻塞、把错误交还给客户端,B 也有效。C 把 w 提高到 4 只会更难满足(三节点副本集上 w:4 基本无法达成),反而加剧阻塞,是最该排除的选项。

所在套题

此题在题库中有 1 条记录。公开详情合并相同题干和选项;完整公开题展示置信度最高的一条记录,其他题目仅展示摘要。按套学习保留每条记录原有的答案、解析和置信度。

作者 · 作品 · 开源

作者与 MongoDB 作品

专注数据平台、MongoDB 迁移同步与云运维产品研发。

有任何 MongoDB 需求,均可联系作者。

联系作者 ↗mlhp123@outlook.com

支持作者

如果题库对您有帮助,欢迎自愿扫码打赏。

支付宝扫码打赏作者打开打赏原图 ↗