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

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

        Activity

          There are no commits yet on this issue.

          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