Suppose you have an ACID database. Without an explicit guarantee about operation ordering, you can still infer ordering as a result of durability.
e.g.
- I insert
xinto a database and the statement returns - Now I insert
y - because of a Durability guarantee, I know
xwas made durable beforey.
Thus, in event of a crash, I either have:
- none of
xoryin the database - only
x - both
xandy.
Now assume a database with a relaxed durability guarantee. e.g. MongoDB without safemode or getlasterror.
What guarantee do I have that the first operation is made durable before the second operation is made durable?
Please point me to the part of documentation that claims this, or the appropriate test.
In event of failure can my database contain y but not x?
EDIT:
It seems the default (only?) storage mechanism is memory-mapped files engine. Without journaling enabled (now enabled by default), it seems a server crash can result in an inconsistent and irreparable state. I guess the answer lies within the journaling.
To answer my own question:
There is a guarantee with journaling. Specifically, the journals are
write-aheadredo logs.Source: http://www.mongodb.org/display/DOCS/Journaling#Journaling-JournalFiles
There is no guarantee (I can find or comprehend) without journaling. MongoDB uses memory-mapped files as it’s primary storage engine. Writes to memory are not immediately reflected in the filesystem. In the case of an OS crash (for example), the files might be in an inconsistent and unrecoverable state.