Is db.stats() a blocking call for MongoDB?

二次信任 提交于 2019-12-23 18:05:36

问题


While researching how to check the size of a MongoDB, I found 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

Looking at the linked bug report (which is still open), it quotes the 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.

However, when I check the current Mongo docs, I don't find that text. Instead, 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.

Does this mean the WiredTiger storage engine changed this to a non-blocking call by keeping ongoing stats?

来源:https://stackoverflow.com/questions/36559408/is-db-stats-a-blocking-call-for-mongodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!