Uploaded image for project: 'Couchbase Go SDK'
  1. Couchbase Go SDK
  2. GOCBC-994

Mutating Null Causes 'KV Error: EINVAL'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.6
    • Fix Version/s: 2.1.7
    • Component/s: library
    • Labels:
      None
    • Environment:
      Couchbase Server 6.0.3 in a Docker container
    • Story Points:
      1

      Description

      Similar to https://issues.couchbase.com/browse/NCBC-2640, but for Go SDK.

       

      When executing a mutation and trying to set `nil` as value, EINVAL is returned.

       

      Example code that I'm using:

      ```

      documentId := "hello1234"

      // First we insert some stuff, then we try to alter it
      _, errInsert := testDb.Collection.Insert(documentId, map[string]interface{}

      { "name": "hello", }

      , nil)
      require.NoError(t, errInsert)

      _, errMutate := testDb.Collection.MutateIn(documentId, []gocb.MutateInSpec

      { gocb.UpsertSpec("name", nil, &gocb.UpsertSpecOptions\{CreatePath: true}

      ),
      }, nil)

      // --> This throws the error <---
      require.NoError(t, errMutate)

      ```

       

      Returned error:

       

      invalid argument | {"status_code":4,"bucket":"bucket_test","scope":"_default","collection":"_default","error_name":"EINVAL","error_description":"Invalid packet","opaque":18,"last_dispatched_to":"192.168.1.109:11210","last_dispatched_from":"192.168.1.105:65378","last_connection_id":"2b9e1bcb4d45f655/7b20324a779687d1"}

        Attachments

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

          Activity

          Hide
          cmaster11 Alberto Marchetti added a comment -

          You're welcome

          Show
          cmaster11 Alberto Marchetti added a comment - You're welcome
          Hide
          charles.dixon Charles Dixon added a comment -

          Alberto Marchetti would you want to make a pull request into https://github.com/couchbase/gocb so that we can merge your change upstream?

          Show
          charles.dixon Charles Dixon added a comment - Alberto Marchetti would you want to make a pull request into  https://github.com/couchbase/gocb so that we can merge your change upstream?
          Hide
          cmaster11 Alberto Marchetti added a comment - - edited

          Opened now. I did not do it before because this is what I consider a temporary patch, and as you may notice I have basically zero tests around and I'm not sure that all those cases are the correct ones. So, please, take it with a pinch of salt!

           

          PR: https://github.com/couchbase/gocb/pull/70

          Show
          cmaster11 Alberto Marchetti added a comment - - edited Opened now. I did not do it before because this is what I consider a temporary patch, and as you may notice I have basically zero tests around and I'm not sure that all those cases are the correct ones. So, please, take it with a pinch of salt!   PR: https://github.com/couchbase/gocb/pull/70
          Hide
          build-team Couchbase Build Team added a comment -

          Build sync_gateway-3.0.0-52 contains gocb commit 48721f3 with commit message:
          GOCBC-994: Convert subdoc nil values to json null

          Show
          build-team Couchbase Build Team added a comment - Build sync_gateway-3.0.0-52 contains gocb commit 48721f3 with commit message: GOCBC-994 : Convert subdoc nil values to json null
          Hide
          build-team Couchbase Build Team added a comment -

          Build couchbase-server-7.0.0-4715 contains gocb commit 48721f3 with commit message:
          GOCBC-994: Convert subdoc nil values to json null

          Show
          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-4715 contains gocb commit 48721f3 with commit message: GOCBC-994 : Convert subdoc nil values to json null

            People

            Assignee:
            charles.dixon Charles Dixon
            Reporter:
            cmaster11 Alberto Marchetti
            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