3 ms·
Tangential but I'm a bit blown away by that mongoDB mention - that it just flushes every 100ms, so you can lose writes. The link in the article is invalid, but
by LAC-Tech 3y ago
Tangential but I'm a bit blown away by that mongoDB mention - that it just flushes every 100ms, so you can lose writes. The link in the article is invalid, but from https://www.mongodb.com/docs/current/core/journaling/ https://www.mongodb.com/docs/current/core/journaling/ we see:
"In between write operations, while the journal records remain in the WiredTiger buffers, updates can be lost following a hard shutdown of mongod."
Does Mongodb acknowledge writes as soon as they've hit the buffers or do they wait for an fsync? Because if the former, that's... shocking for a database people use as a source of truth.
- tontinton 3y agoThanks for pointing out the link is bad! I just fixed it. And yeah this was shocking to me as well.
- dgottlieb 3y agoWrites in MongoDB are persisted before the server returns acknowledgement. For a typical replica set deployment, this additionally means replicated and made durable on disk for a majority of nodes. MongoDB has tunable durability guarantees; clients can opt-out of this behavior. The layers are deep, but this is the function that handles waiting before acknowledgement: https://github.com/mongodb/mongo/blob/20f42d9dc89999d119f35ab3261a0d3ae6e85087/src/mongo/db/write_concern.cpp#L276-L279 https://github.com/mongodb/mongo/blob/20f42d9dc89999d119f35a...