Skip to content
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

Fix equal/2 bug around unordered dict usage #135

Merged
merged 1 commit into from
Feb 20, 2018
Merged

Conversation

russelldb
Copy link
Member

When riak_dt_map moved from orddict to dict the equal/2 function
was not updated to reflect that the deferred operations list was now
an unordered dict, meaning two equal maps could report as unequal just
because of the order of operations in the deferred dict. The bug was
found by the added counter-example
test/non-commute-counter-example.eqc.

I also added a function map_eqc:check/1 so that any counter-example
file can be easily run from the shell.

Run ./rebar eunit skip_deps=true deps_dir=../ compile_only=true and
then erl -pa .eunit/ and
map_eqc:check("test/non-commute-counter-example.eqc") before and after
the change to riak_dt_map.erl to verify the fix.

When `riak_dt_map` moved from `orddict` to `dict` the `equal/2` function
was not updated to reflect that the `deferred` operations list was now
an unordered `dict`, meaning two equal maps could report as unequal just
because of the order of operations in the deferred dict. The bug was
found by the added counter-example
`test/non-commute-counter-example.eqc`.

I also added a function `map_eqc:check/1` so that any counter-example
file can be easily run from the shell.

Run `./rebar eunit skip_deps=true deps_dir=../ compile_only=true` and
then `erl -pa .eunit/` and
`map_eqc:check("test/non-commute-counter-example.eqc")` before and after
the change to `riak_dt_map.erl` to verify the fix.
@martincox
Copy link
Contributor

+1

@russelldb russelldb merged commit fa48c45 into develop-2.2 Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants