Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
-
1
-
SDK22
Description
- Add new versions of `MutateInSpec.incrementAndGet` and `decrementAndGet` without a `delta` parameter ("increment/decrement" implies the delta is 1).
- Add an `addAndGet` method that takes a delta.
- Deprecate the old increment/decrement methods that take a delta, in favor of addAndGet.
This aligns the subdocument counter methods with Java's AtomicLong methods, and side-steps the problem of what to do if the user attempts to subtract Long.MIN_VALUE. (The current implementation of decrementAndGet that takes a delta is flawed because it naively negates the delta and then delegates to incrementAndGet. This fails if the delta is `Long.MIN_VALUE`, because negating `Long.MIN_VALUE` has no effect.)
Attachments
For Gerrit Dashboard: KCBC-123 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
191852,2 | KCBC-123 Improve sub-document counter methods | master | couchbase-jvm-clients | Status: MERGED | +2 | +1 |