Uploaded image for project: 'Couchbase Ruby client library'
  1. Couchbase Ruby client library
  2. RCBC-160

increment method increments negative value, contrary to method description

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 1.3.5
    • None
    • None
    • Security Level: Public
    • None

    Description

      The method description of increment indicates:
      "Couchbase Server stores numbers as unsigned numbers, therefore if you try to increment an existing negative number, it will cause an integer overflow and return a non-logical numeric result. "

      But, if the increment makes the value a positive number the increment is applied and integer overflow does not occur. The integer overflow occurs only if after the increment the value is still negative.

      Example does not generate error:
      require 'rubygems'
      require 'couchbase'
      client = Couchbase.connect("http://localhost:8091")
      client.set("2",-1)
      client.increment("2",2)

      Example generates error:
      require 'rubygems'
      require 'couchbase'
      client = Couchbase.connect("http://localhost:8091")
      client.set("2",-3)
      client.increment("2",2)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            dvohra deepak vohra
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty