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

Mutating Null Causes 'KV Error: EINVAL'

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.6
    • 2.1.7
    • library
    • None
    • Couchbase Server 6.0.3 in a Docker container
    • 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

        For Gerrit Dashboard: GOCBC-994
        # Subject Branch Project Status CR V

        Activity

          cmaster11 Alberto Marchetti created issue -

          Just tested, and got same error also on Community Edition 6.0.0 build 1693

           

          Quite a blocker before being able to upgrade from SDK V1 to V2

          cmaster11 Alberto Marchetti added a comment - Just tested, and got same error also on Community Edition 6.0.0 build 1693   Quite a blocker before being able to upgrade from SDK V1 to V2

          As additional info, I'm using the legacy transcoder, as this problem is in the context of a migration from V1 to V2

          cmaster11 Alberto Marchetti added a comment - As additional info, I'm using the legacy transcoder, as this problem is in the context of a migration from V1 to V2

          For the sake of going on with the migration successfully, I created a temporary patch, which is working for the moment in fixing the issue. you can check the changes at https://github.com/cmaster11/gocb/pull/1/files

           

          cmaster11 Alberto Marchetti added a comment - For the sake of going on with the migration successfully, I created a temporary patch, which is working for the moment in fixing the issue. you can check the changes at  https://github.com/cmaster11/gocb/pull/1/files  
          charles.dixon Charles Dixon made changes -
          Field Original Value New Value
          Status New [ 10003 ] Open [ 1 ]
          charles.dixon Charles Dixon made changes -
          Fix Version/s 2.1.7 [ 17056 ]
          charles.dixon Charles Dixon made changes -
          Assignee Brett Lawson [ brett19 ] Charles Dixon [ charles.dixon ]
          charles.dixon Charles Dixon added a comment - - edited

          Thanks for raising (and solving!) this Alberto Marchetti.

          charles.dixon Charles Dixon added a comment - - edited Thanks for raising (and solving!) this Alberto Marchetti .

          You're welcome

          cmaster11 Alberto Marchetti added a comment - You're welcome

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

          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?
          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

          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
          charles.dixon Charles Dixon made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          charles.dixon Charles Dixon made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]

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

          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

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

          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

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

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

          People

            charles.dixon Charles Dixon
            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