On 08/28/2014 07:24 AM, Florian Weimer wrote:
Even on Linux, sparse files which are filled incrementally can result in lots of fragmentation, huge extent lists (tens of thousands of entries longs), and long delays when opening such files.
The only "hole" is at the end. So this shouldn't be different from just write()ing at the end of a non-sparse file: lmdb uses new file pages in the same order either way.
Except with put(,,data size >= 2 pages, MDB_RESERVE) and the user filling in the item from the end forward. Then there will temporarily be a hole in the middle of the item. I suppose if the user fills the item in slowly enough for the OS to fsync, the file will get fragmented.
I suppose mdb_page_alloc() with WRITEMAP could memset new file pages, or at least set one word in each new OS page. I expect user programs usually fill in MDB_RESERVE items quickly though, so hopefully it won't matter.