[Date Prev][Date Next]
Re: (ITS#7969) LMDB: Globally shared fields of meta-data are not 'volatile'.
On 01/12/2015 07:15 PM, firstname.lastname@example.org wrote:
> Unfortunately IMDB programmed without accounting possibility of memory
> reordering and cache incoherency (as a proof - the 'volatile' was
> missed before ITS#7969).
> So, currently seems LMDB is durable only on x86 and may be on MIPS.
I gather "volatile" in thread code can be read as "warning: dubious
code" or at best "please access this sooner rather than later".
comp.programming.threads's advise is that volatile is useless for thread
sync: You need sync primitives, and then you don't need volatile since
the compiler/hardware may not move the memory access past the primitive.
Unless the primitive's spec says so, I guess. E.g. with an "asm"
statement where the compiler does not know what the assembly code does
and must be told not to mess with ordering.
The best fix is likely a format change which reduces the need for sync
primitives, for LDMBv2. Checksum the MDB_meta, and/or replace the
variable part with a single word which refers to the meta.
Don't know if we can get rid of unportable sync code though.
Leaving the rest to Howard, I'm too busy just now to do more than blow