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

Opening a bucket twice leads to incorrect behaviour on both buckets

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.2
    • 2.0.3
    • None
    • None
    • 1

    Description

      After moving to v2 i noticed all my tests were failing saying "Not connected to a bucket". I was reusing the cluster connection but with buckets i was just getting them via cluster.Bucket() each time. So after breaking out a completely separate test I found out it was because I need to reuse the bucket connection. Now unfortunately it wasn't clear in the docs that this was the case. With all that being said the idea that if for whatever reason i didnt reuse the bucket connection to me sounds like a decent bug. Below is the code i used to replicate this issue.

       

      func TestSimple(t *testing.T) {    cluster, err := gocb.Connect(        "localhost",        gocb.ClusterOptions{            Username: "Administrator",            Password: "password",        })    if err != nil {        panic(err)    }
          bucket := cluster.Bucket("vault")    collection := bucket.DefaultCollection()
          // Upsert Document    upsertData := map[string]string{"name": "mike"}    upsertResult, err := collection.Upsert("my-document", upsertData, &gocb.UpsertOptions{})    if err != nil {        panic(err)    }    fmt.Println(upsertResult)
          bucket2 := cluster.Bucket("vault")    collection2 := bucket2.DefaultCollection()
          // Get Document    getResult, err := collection2.Get("my-document", &gocb.GetOptions{})    if err != nil {        panic(err)    }    fmt.Println(getResult)}
      

      Attachments

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

        Activity

          bvoelker Brian Voelker created issue -
          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.0.3 [ 16724 ]
          charles.dixon Charles Dixon made changes -
          Summary Not connected to a bucket Opening a bucket twice leads to incorrect behaviour on both buckets
          charles.dixon Charles Dixon made changes -
          Assignee Brett Lawson [ brett19 ] Charles Dixon [ charles.dixon ]
          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 ]
          brett19 Brett Lawson made changes -
          Story Points 1

          Build couchbase-server-7.0.0-3115 contains gocb commit ac5a1f3 with commit message:
          GOCBC-817: Don't reconnect clients if they already exist

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-3115 contains gocb commit ac5a1f3 with commit message: GOCBC-817 : Don't reconnect clients if they already exist

          Build sync_gateway-3.0.0-52 contains gocb commit ac5a1f3 with commit message:
          GOCBC-817: Don't reconnect clients if they already exist

          build-team Couchbase Build Team added a comment - Build sync_gateway-3.0.0-52 contains gocb commit ac5a1f3 with commit message: GOCBC-817 : Don't reconnect clients if they already exist

          People

            charles.dixon Charles Dixon
            bvoelker Brian Voelker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty