gpt4 book ai didi

mongodb - db.stats() 是对 MongoDB 的阻塞调用吗?

转载 作者:行者123 更新时间:2023-12-05 07:50:01 25 4
gpt4 key购买 nike

在研究如何检查 MongoDB 的大小时,我发现了 this comment :

Be warned that dbstats blocks your database while it runs, so it's not suitable in production. https://jira.mongodb.org/browse/SERVER-5714

查看链接的错误报告(仍处于打开状态),它引用了 Mongo docs as saying :

Command takes some time to run, typically a few seconds unless the .ns file is very large (via use of --nssize). While running other operations may be blocked.

但是,当我查看当前的 Mongo 文档时,我没有找到该文本。相反,they say :

The time required to run the command depends on the total size of the database. Because the command must touch all data files, the command may take several seconds to run.

For MongoDB instances using the WiredTiger storage engine, after an unclean shutdown, statistics on size and count may off by up to 1000 documents as reported by collStats, dbStats, count. To restore the correct statistics for the collection, run validate on the collection.

这是否意味着 WiredTiger 存储引擎通过保持持续的统计信息将其更改为非阻塞调用?

最佳答案

游戏有点晚了,但我在寻找答案时发现了这个问题,答案是:Yes until 3.6.12/4.0.5 it was acquiring a "shared"lock ( “R”)在执行期间阻止所有写请求。之后,它现在是一个不会阻止写请求的“意图共享”锁(“r”)。读取请求不受影响。

来源:https://jira.mongodb.org/browse/SERVER-36437

关于mongodb - db.stats() 是对 MongoDB 的阻塞调用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36559408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com