nickva opened a new pull request, #5373:
URL: https://github.com/apache/couchdb/pull/5373

   Remove `pread_iolist/2`, `IS_OLD_STATE`, `close` cast handler and `0110 
upgrade code.
   
   Make `pread_binary/2` return a proper `{error, Error}` term instead of 
letting it crash with a `badmatch`. It was already documented to return an 
error tuple.
   
   Implement `pread_binary` and `pread_terms` as instances of `pread_binaries` 
and `pread_terms`. This reduces code size quite a bit, as the gen_server now 
only has to handle `{pread_iolists, ...}` and `{append_binaries, ...}` as the 
main data path calls. Internally, Erlang/OTP VM may still fallback to 
non-vectorized pread and pwrite versions, but that's handled transparently. 
Besides, we never really handled it as a fallback anyway, it was just plain 
code duplication.
   
   Fix bug in `{pread_iolists, ...}` call handler, where it incorrectly matched 
`IoList` in the `{Checksum, IoList} = extract_checksum(IoList)` line. We never 
had tests for this function, so also add tests for it.
   
   `read_beyond_eof` and `exceed_pread_limit` incorrectly used throw 
functionality from a gen_server. Gen servers handle throws as early returns, 
however the terms we threw were not proper replies, to servers crashed with an 
unrelated `bad_return` error previously. Maintain the top level behavior of 
crashing the gen_server on those error, but provide neater error both to the 
caller and as the gen_server crash reason. Update tests to assert that this 
happens.
   
   Optimize `verify_checksum/5`. Since we removed `pread_iolist/2` this 
function can deal with just binaries, and we never have to turn our iolists 
into binaries just to run `verify_checksum/5` so we avoid wasting another call 
to `iolist_to_binary/1` and then throwing the result away.
   
   Increase test coverage from 66% to 90%.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to