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
, thefsync: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.
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?
the write-ahead-log is fsync'ed every 100ms.
精彩评论