MongoDB(启用日记功能)何时调用fsync()?

时间:2021-12-13 08:46:06

Since version 1.7.5 MongoDB supports so called "Single Server Durability". According to the documentation, this is achieved by using a write-ahead-log that can be replied in the event of a server crash.

从版本1.7.5开始,MongoDB支持所谓的“单服务器持久性”。根据文档,这是通过使用可在服务器崩溃时可以回复的预写日志来实现的。

I have trouble understanding the "Commit Acknowledgement" section of the "Journaling" page in MongoDB documentation:

我无法理解MongoDB文档中“日记”页面的“提交确认”部分:

You can wait for group commit acknowledgement with the getLastError command. When running with --dur, the fsync:true option returns after the data is physically written to the journal (rather than actually fsync'ing). Note that the group commit interval (see above) is considerable: you may prefer to call getLastError without fsync, or with a w: parameter instead with replication. In releases after 1.8.0 the delay for commit acknowledgement will be shorter.

您可以使用getLastError命令等待组提交确认。使用--dur运行时,fsync:true选项在数据物理写入日志(而不是实际fsync'ing)后返回。请注意,组提交间隔(见上文)相当可观:您可能更喜欢在没有fsync的情况下调用getLastError,或者使用w:参数调用复制。在1.8.0之后的版本中,提交确认的延迟将更短。

Does this mean that journaling relies on the operating system to flush the changes to the disk? Or does it mean that the write-ahead-log is fsync'ed every 100ms no matter whether user requests it to be fsync'ed or not?

这是否意味着日记依赖于操作系统来刷新磁盘的更改?或者它是否意味着无论用户是否请求fsync,都会每隔100ms对fsync进行一次写入预测?

1 个解决方案

#1


1  

the write-ahead-log is fsync'ed every 100ms.

预写日志每100ms进行一次fsync。

#1


1  

the write-ahead-log is fsync'ed every 100ms.

预写日志每100ms进行一次fsync。