Skip to content

Fix equal/2 bug around unordered dict usage#135

Merged
russelldb merged 1 commit into
develop-2.2from
develop-2.2.5
Feb 20, 2018
Merged

Fix equal/2 bug around unordered dict usage#135
russelldb merged 1 commit into
develop-2.2from
develop-2.2.5

Conversation

@russelldb

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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