-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Michael, here are a set of changes that use posix_fallocate or ftruncate to extend files.
Smoke testing with wtperf -S on bengal makes me think they are potentially useful for LSM on an ext4 filesystem, but I don't have good evidence for that claim, yet.
A couple comments:
1. I implemented this a couple of times, once with the work being done in the os_rw:_wt_write() function and once where it is now, in the block_write.c:_wt_block_write_off() function. The advantage of doing it in *wt_write() is that it just happens for all file types, of course. I ended up leaving the change in *wt_block_write_off because otherwise we extend the file when we write the description block at the beginning of the file, which I didn't much like. See the next comment...
2. We truncate the file during verification and when we load a checkpoint for writing, so there's some noise going back-and-forth between an extended file and a truncated one. I think that's probably OK, and unavoidable given the tension between keeping files small, and not extending them block-by-block.
This does mean that if you load a bunch of records and then write a checkpoint and close the handle, the file will be left much longer than it might otherwise be: if you then open it and close it again, it will be truncated, and left truncated. That's not intuitive, but it seems to me that if you're configuring this option, bigger files shouldn't surprise you.
I've tucked a few comments into the diff as well, if you decide this is interesting enough to review & incorporate into develop.