https://bugs.openldap.org/show_bug.cgi?id=10260
Issue ID: 10260 Summary: Document alignment of MDB_val.mv_data Product: LMDB Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: sascha@brawer.ch Target Milestone: ---
In lmdb.h, could the documentation for MDB_val talk about alignment of mv_data?
For example, is the key guaranteed to be aligned to an 8-byte boundary if a table got created with MDB_INTEGERKEY? What about values in MDB_INTEGERDUP tables? Can database values be directly loaded into SIMD registers (of what width?) without first copying the data to an aligned location?
On some processor architectures, unaliged reads lead to bus errors; therefore, it would help programmers to know whether LMDB makes any alignment guarantees. Even if clients cannot assume anything, it would be good if LMDB’s public API documentation could state so.
Many thanks for documenting this! Just adding 1 or 2 sentences to the MDB_val section in lmdb.h would be enough.
— Sascha Brawer, sascha@brawer.ch