简体   繁体   中英

When does MongoDB (with journaling enabled) call fsync()?

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.

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

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 aw: parameter instead with replication. In releases after 1.8.0 the delay for commit acknowledgement will be shorter.

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM