Skip to content

Bugfix/key transform crash #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2014
Merged

Bugfix/key transform crash #186

merged 2 commits into from
Sep 9, 2014

Conversation

engelsanchez
Copy link
Contributor

When merging completely expired files, we fold over them issuing
conditional keydir deletes on the entries of the file. That way, if any
of them are still present in the keydir, they will be deleted now
instead of the usual lazy delete on read, when we detect they are
expired.

Previously, the code was not accounting for the new {tombstone, Key}
return format when folding over the hintfile. A recent change in 1.7.0
added a tombstone bit flag to hintfiles, so now we can tell we are
dealing with a tombstone without inspecting the data file. The tuple was
being passed whole to the userdefined key transformation function, causing
a crash. With this change, we simply skip over tombstones. It makes no
sense to try to delete them from the keydir.

This fixes #185 in the 1.7 branch (Bitcask shipped with Riak 2.0.0).
When merged, this should be ported or merged to the develop branch also.

Change the default key transformation to only allow binaries. This will
make it have the same assumption that previous user defined key transforms
have had since they were created. It will fail if it gets passed a
{tombstone, Key} tuple, which is the problem being fixed here.
Run a merge with completely expired files, one of which contains a
tombstone. This will trigger the path that passes the {tombstone, Key}
instead of just the Key to the key transformer. This will fail with a
function_clause error as expected.
When merging completely expired files, we fold over them issuing
conditional keydir deletes on the entries of the file. That way, if any
of them are still present in the keydir, they will be deleted now
instead of the usual lazy delete on read, when we detect they are
expired.

Previously, the code was not accounting for the new {tombstone, Key}
return format when folding over the hintfile. A recent change in 1.7.0
added a tombstone bit flag to hintfiles, so now we can tell we are
dealing with a tombstone.  The tuple was being passed whole to the user
defined key transformation function, causing a crash. With this change,
we simply skip over tombstones. It makes no sense to try to delete them
from the keydir.
@engelsanchez engelsanchez added this to the 2.0.1 milestone Sep 4, 2014
@jonmeredith
Copy link
Contributor

+1 5fbb8f7

Reviewed code, accounts for the tombstone response returned by bitcask_fileops:fold_keys.
Audited code for other instances of bitcask_fileops and those folders already accounted for {tombstone, …}.
Ran the eunit test with coverage testing enabled and confirmed it hit the case and failed in the commit before the fix.
Full eunit test passes for me. Will see if borshop agrees with me.

borshop added a commit that referenced this pull request Sep 6, 2014
Bugfix/key transform crash

Reviewed-by: jonmeredith
@engelsanchez
Copy link
Contributor Author

@borshop merge

@borshop borshop merged commit 5fbb8f7 into 1.7 Sep 9, 2014
@seancribbs seancribbs deleted the bugfix/key-transform-crash branch April 1, 2015 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants