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

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: None
    • Labels:
      None
    • Story Points:
      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

          Hide
          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

          Show
          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
          Hide
          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

          Show
          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

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