[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LMDB data corruption/alignment issues on ARM
- To: Howard Chu <hyc@symas.com>
- Subject: Re: LMDB data corruption/alignment issues on ARM
- From: Martin Lucina <martin@lucina.net>
- Date: Fri, 25 Apr 2014 10:42:33 +0200
- Cc: openldap-technical@openldap.org
- Content-disposition: inline
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lucina.net; s=dkim-201309; t=1398415332; bh=WMGIwk2mF0lodYaUREodnZpNk7pOwc77/SN8mQVJKo0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LqmxRhQ3f2Ry+V5DziOLZIRKcjIkry8X6xq2Sc1JlDuVbeA0u+EhK46ikvnpPnxuE WPrF0pICoud1AeyaVWrAtFUqEXIkjWGLryj69wN4ZjeJhut8Ic67w5Wm5lWyzyBeHl m7qd0EqzAcLwZX7bXSSRyn20xCRn24GB4xMfMX2MSaivcDDaYkZBdP/qTelgPK6ryW KsRvg1EJWfmQi8ncM+9sMbEtqROHCdv4tkYpgJJeZfaahRbxwbNlxZJdDiuwJRg7Fn CrG7ZSjKbHfcMHspqdloMZtuqw9VdxP0ehSL+uEpz3DgJEyFKM8G1NNmuKy3CCtlVB V1o53SMYMmI5A==
- In-reply-to: <5359BA53.6090004@symas.com>
- Mail-followup-to: Howard Chu <hyc@symas.com>, openldap-technical@openldap.org
- References: <20140424190818.GA24981@nodbug.moloch.sk> <5359BA53.6090004@symas.com>
- User-agent: Mutt/1.5.21 (2010-09-15)
hyc@symas.com said:
> >My question is: Given that I'm storing C structs directly in LMDB, I need
> >to get at least word-aligned pointers back from LMDB in order to be able to
> >access the data safely.
> >
> >I've not found anything in the documentation or the source about being able
> >to tweak alignment of key and data values; I *think* that all I need is an
> >option where LMDB would guarantee a minimum word (4 byte in this case)
> >alignment of data.
> >
> >How hard would this be to implement? Would you consider such a feature?
>
> LMDB guarantees 2-byte alignment of keys, and data is generally
> stored contiguously with keys. If you want 4-byte alignment, it's
> your responsibility to pad your keys to 4-byte boundaries. If you
> pad appropriately, your alignment will be preserved.
In this case the keys are size_t (4 bytes on the target) and I'm using
MDB_INTEGERKEY. I'm not sure what you mean by padding the keys to 4-byte
boundaries given that LMDB copies my data into its memory map and I have no
control over where it gets placed.
Martin