[Date Prev][Date Next] [Chronological] [Thread] [Top]

LMDB: EIO/MDB_INVALID and use of pwrite/pread



Hi there,
 
We've seeing commits fail with EIO (5). Because this is not a very specific reason, I digged a bit into LMDB's code.
 
EIO ist actually also set by LMDB, e.g. if a pwrite does not write all bytes given to it. Code example:
 
    rc = EIO; /* TODO: Use which error code? */
    DPUTS("short write, filesystem full?");
 
The documentation of pwrite says, pwrite will write UP TO the given amount of bytes. Why are we not writing data in a loop (until all bytes are written, using offset and adjust length)? Are we sure that this would never help pwrite to succeed? Even if so, wouldn't we get a better error message when pwrite fails on the call after the partial write?
 
Secondly, we are also seeing MDB_INVALID, which could be caused by pread as used by mdb_env_read_header. Similarily, a sucessful pread may not read all requested bytes.
 
What do you think?
 
Thanks,
Markus