Hello,
I have two LMDB databases, identical except one has key size 34 bytes and the other key size 33 bytes. (Both have same value sizes and same number of pairs).
How can the file sizes on disk be exactly the same? Is this because of the 2-byte alignment mentioned here? https://github.com/AltSysrq/lmdb-zero/issues/8
I wonder if this 2-byte alignment was documented anywhere.
This doesn't bother me btw. I was just expecting the file sizes to differ (got scared I had a bug in my program until I did an mdb_dump to see the real difference)
Thanks, Samuel
Sam Dave wrote:
Hello,
I have two LMDB databases, identical except one has key size 34 bytes and the other key size 33 bytes. (Both have same value sizes and same number of pairs).
How can the file sizes on disk be exactly the same? Is this because of the 2-byte alignment mentioned here? https://github.com/AltSysrq/lmdb-zero/issues/8
I wonder if this 2-byte alignment was documented anywhere.
RTFM.
http://www.lmdb.tech/doc/group__internal.html
Search for "align"
Thanks for pointing me to the concept of nodes (had never heard of them before.. as an LMDB user for years I haven't had the need be aware of this internal manual until now).
Out of curiosity, what were the reasons for the design decision of using a 2-byte alignment?
Regards, Sam
Oct 13, 2023, 19:26 by hyc@symas.com:
Sam Dave wrote:
Hello,
I have two LMDB databases, identical except one has key size 34 bytes and the other key size 33 bytes. (Both have same value sizes and same number of pairs).
How can the file sizes on disk be exactly the same? Is this because of the 2-byte alignment mentioned here? https://github.com/AltSysrq/lmdb-zero/issues/8
I wonder if this 2-byte alignment was documented anywhere.
RTFM.
http://www.lmdb.tech/doc/group__internal.html
Search for "align"
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
openldap-technical@openldap.org