Re:Are You Sure You Want to Use MMAP in Your Database Manage...
by ayende on Thursday July 06, 2023 @06:02AM
(#36613623)
Doesn't help when you work with pages :-)
Assume 512 sectors ( I know those are rare ), but I don't think that there is any guarantees that 4KB page would be:
* Written atomically * Written in a particular order
Re:Are You Sure You Want to Use MMAP in Your Database Manage...
by colanderman on Thursday July 06, 2023 @03:17PM
(#36621326)
Even memory ordering guarantees within sector boundaries are sufficient, and something the kernel could provide on its own.
Re:Are You Sure You Want to Use MMAP in Your Database Manage...
by ayende on Thursday July 06, 2023 @06:03AM
(#36613636)
Also doesn't help when you are running on virtual / networked hardware. Nothing ensure that what you think is a sector write would actually align properly with the hardware.
Re:Are You Sure You Want to Use MMAP in Your Database Manage...
by colanderman on Thursday July 06, 2023 @03:14PM
(#36621287)
The design and guarantees of the virtualized hardware provide that guarantee. I've worked on several such products. They all guarantee atomic sector writes (typically via copy-on-write).
> Currently all hard drive/SSD manufacturers guarantee that 512 byte sector writes are atomic. As such, failure to write the 106 byte header is not something we account for in current LMDB releases. Also, failures of this type should result in ECC errors in the disk sector - it should be impossible to successfully read a sector that was written incorrectly in the ways you describe.
Even in extreme cases, the probability of failure to write the leading 128 out of 512 bytes of a sector is nearly nil - even on very old hard drives, before 512-byte sector write guarantees. We would have to go back nearly 30 years to find such a device, e.g.
https://archive.org/details/bitsavers_quantumQuaroductManual...
Page 23, Section 2.1 "No damage or loss of data will occur if power is applied or removed during drive operation, except that data may be lost in the sector being written at the time of power loss."
^ above quoted from https://lists.openldap.org/hyperkitty/list/openldap-devel@op...