Closed lucperkins closed 9 years ago
Problem 2 seems like something that's reared its head again.
I think a while ago we made sure that decrements by negative numbers were undefined. decrements by positives, and increments by negatives and positives are defined. This may just be an error message not surfacing.
Frankly, the code related to JSON decoding is actually in riak_kv, but russell has omniscience over all of this anyway.
This is all riak_kv, there is no API code in DT. The data type itself does not allow negative decrements. The error seems to be crashing riak's vnode. Please open against riak_kv
I've detected two problems in the HTTP API for counters.
Problem 1
You can pass in a raw integer as valid JSON. The following will work:
This will increment the counter by 5. Relatedly, passing in
-5
will decrement the counter. Requiring that you specify JSON as the content type yet allowing you to pass in invalid JSON strikes me as a bug.Problem 2
If you attempt to decrement by a negative integer, the operation will simply hang indefinitely. Here's an example:
It seems to me that this should either result in a positive increment or throw an error.