Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-6961

result of INCR operations should show up in views as JSON number, not base64 string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta
    • Fix Version/s: 2.0
    • Component/s: couchbase-bucket
    • Security Level: Public
    • Labels:
      None

      Description

      When I create a document via INCR or DECR, the contents of the document end up being string representations of the number. This is great because these representations are valid JSON fragments. However, somewhere along the way this greatness is lost. By the time the ascii numerals get to the view engine, they've been base64 encoded as though they are random binary that we don't know how to handle. This is against spec. The plan was to make it so these values show up in the map function as numbers.

      So a map function like this, run on a bucket where all the documents were generated by INCR, would give a leaderboard type result.

      function(doc, meta)

      { emit(doc, null) }

      eg the sort keys in the index would be numbers like 1, 5, 88, etc. I'm attaching a screenshot where you can see that instead we get base64 encoded strings. It is possible to decode these strings and coerce them to numbers inside the map function. At one point I merged a patch that makes it so the default map function illustrated how to do that sort of thing, but it was removed for a less instructive default map function. If we fix this bug, then we wouldn't need to instruct anything in the map function anyway... so let's fix the bug.

        Issue Links

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

          Activity

          Hide
          thuan Thuan Nguyen added a comment -

          Integrated in github-ep-engine-2-0 #448 (See http://qa.hq.northscale.net/job/github-ep-engine-2-0/448/)
          MB-6961 Fix validation of numbers as JSON (Revision f7fa4f21aaaf8d25d490c0291a320331c16431fc)

          Result = SUCCESS
          aaron :
          Files :

          • tools/JSON_checker.c
          Show
          thuan Thuan Nguyen added a comment - Integrated in github-ep-engine-2-0 #448 (See http://qa.hq.northscale.net/job/github-ep-engine-2-0/448/ ) MB-6961 Fix validation of numbers as JSON (Revision f7fa4f21aaaf8d25d490c0291a320331c16431fc) Result = SUCCESS aaron : Files : tools/JSON_checker.c
          Hide
          steve Steve Yen added a comment -

          Looks like the fix got past gerrit. So, it's now resolved?

          Show
          steve Steve Yen added a comment - Looks like the fix got past gerrit. So, it's now resolved?
          Hide
          aaron Aaron Miller (Inactive) added a comment -

          Yes. I posted a screenshot on the gerrit review showing views of INCR'd values working correctly as of the patch.

          Show
          aaron Aaron Miller (Inactive) added a comment - Yes. I posted a screenshot on the gerrit review showing views of INCR'd values working correctly as of the patch.
          Hide
          farshid Farshid Ghods (Inactive) added a comment -

          Deep,

          can you veirfy this fix and close ?

          Show
          farshid Farshid Ghods (Inactive) added a comment - Deep, can you veirfy this fix and close ?
          Hide
          iryna iryna added a comment -

          build-1901
          verified

          Show
          iryna iryna added a comment - build-1901 verified

            People

            • Assignee:
              iryna iryna
              Reporter:
              jchrisa J Chris Anderson [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes