Fix incorrect NIF error tuples #39

Merged
merged 1 commit into from Mar 6, 2012

Conversation

Projects
None yet
2 participants
Contributor

jtuple commented Mar 4, 2012

Certain Bitcask NIFs would return {error, {error, Reason}} on failure rather than the expected {error, Reason} tuple. This would cause certain pattern matches to fail, such as the following:
https://github.com/basho/bitcask/blob/31b782aa4096d6084e57108f1ee0035be583dc50/src/bitcask.erl#L808

This pull-request fixes this error tuples.

Contributor

jonmeredith commented Mar 5, 2012

Review of code looks good - can't find any other places where errors tuples are being wrapped and can trigger the new code easily enough.

7> [bitcask:put(Ref, <<I:32/integer>>, Bin) || I <- lists:seq(1,30000)].
** exception error: no match of right hand side value {error,enospc}
     in function  bitcask_fileops:write/4
     in call from bitcask:do_put/5
     in call from bitcask:put/3

Will review the erlang code calling the NIFs, then should be +1 for merge.

Contributor

jonmeredith commented Mar 6, 2012

Passes bctt test and pulses tests.

+1 merge.

@jtuple jtuple merged commit 60e232b into master Mar 6, 2012

engelsanchez deleted the jdb-bitcask-nif-errors branch Mar 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment