garlik/4store — pull request #91 by arekinath (2012-10-31 08:20:18+00:00)
Title: Consistent mmap i/o for ptable and tbchain

So with the last pwrite/pread + mmap patch I thought I was done! Then I tried it out on a VM and everything exploded. VMs are often very racey, so it turned out to be more multicore consistency fun for OpenBSD with mmap I/O and non-mmap I/O hitting the same file.

This patch, similar to the last one, changes ptable/tbchain to do all of their file I/O via mmap, and change file sizes using ftruncate. It also adds msyncs before unmapping, just to make sure that things don't get weird. These might not be strictly necessary... and it could enhance insert/import performance a tiny bit if they were removed (I haven't noticed any numbers dropping here because I added them, though). It's really hard to tell with these racey issues, because they love to appear and disappear at 'random'. They can only add extra cost when expanding the files, and the doubling logic should stop that from dominating the performance anyway.

I've now tried OpenBSD on bare metal and in VMs, with both 5.1-stable and 5.2-current snapshots, and it looks like it's almost there!

(also, sorry for the constant spam at the moment, I would have put this patch in the same pull request as the other pwrite changes, but I didn't realise it was necessary when I sent it)