Use vectored reads to search for buried headers

Current behavior attempts to read a header at each block, starting at
the eof and working backwards one block at a time. Deeply buried headers
can take a long time to find, depending on the depth of the header,
server load, etc.

This commit changes the behavior so that if the last block in the file
does not contain a header, it switches to using a "vectored" approach
where multiple candidate header prefixes (of 5 bytes) are read in a
single operation, greatly speeding up the search. On a modern linux
system with SSD, we see improvements up to 15x.

COUCHDB-3061
1 file changed
tree: 81be3bce2de11de410c79cb0d94748b00169703c
  1. include/
  2. priv/
  3. src/
  4. test/
  5. .gitignore
  6. .travis.yml
  7. LICENSE
  8. rebar.config.script