bitcoin/bitcoin — pull request #3340 by pstratem (2013-12-02 05:29:25+00:00)
Title: Replace use of mmap in leveldb for improved reliability

There has been speculation recently that the issue OS X users are seeing is related to a bug in leveldb related to mmap.

This replaces all mmap use in the posix environment handler with pread and write calls.

There is a performance impact which is significant with microbenchmarks for sequential writes. (db_bench)

However bitcoin tends to make large batched writes instead of large numbers of smaller writes which significantly reduces the impact.

I could not measure a meaningful difference in reindex time (using txindex=1) from 1-100k blocks total time was 27 seconds for the mmap version and 28 seconds with this patch.