basho / riak_dt

Convergent replicated datatypes in Erlang
Apache License 2.0
353 stars 70 forks source link

Support negative counter increments and decrements #97

Closed lenary closed 10 years ago

lenary commented 10 years ago

Apparently a boog in emcounter. Fixed, so server-side should have no errors with any integers and any of increment and decrement.

russelldb commented 10 years ago

How do I test this? Please provide the steps that provoke the bug this fixes, so I can verify. Also, a test that shows the bug and the fix would be very valuable (be it a riak_test, or a local unit test)

macintux commented 10 years ago

I don't think this is entirely correct: IIRC from looking at this code yesterday the Erlang specs indicate positive integers only, so that will have to be tweaked (although buildbot didn't gripe about Dialyzer).

I also suspected this should be handled one layer higher in the stack, but haven't looked to see where that would be.

Testing should be easy: fire up the Erlang client and send a single decrement. That should crash a node IIRC.

Will look more in a bit.

Thanks @lenary, really appreciate you getting this started.

lenary commented 10 years ago

@russelldb there's a new eunit test in 9109d7e

russelldb commented 10 years ago

Thanks @lenary this all works fine now

+1 9109d7e

macintux commented 10 years ago

I assume we need to fix the specs before merging

macintux commented 10 years ago

@borshop merge