Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1046

SDK sending SETs to default collection when not asked too

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • .backlog3.x
    • None
    • None
    • None
    • one cluster_run node
      Couchbase Python SDK 3.0.3
      Python 3.8
    • 1

    Description

      When running the following code I se SET pacets being sent from the SDK client with the collection ID set to 0x0:

      from time import sleep
       
      from couchbase.cluster import Cluster, ClusterOptions
      from couchbase.management.collections import CollectionSpec
      from couchbase_core.cluster import PasswordAuthenticator
      from couchbase.management.admin import Admin
       
      ip = '127.0.0.1'
       
      adm = Admin('Administrator', 'password', host=ip, port=9000)
      adm.bucket_remove('test')
      adm.bucket_create('test', bucket_type='couchbase', ram_quota='100')
       
      sleep(10)
       
      cluster = Cluster('couchbase://' + ip + ':12000', ClusterOptions(PasswordAuthenticator('Administrator', 'password')))
      cb = cluster.bucket('test')
       
      collMan = cb.collections()
      run = 0
      while run < 5:
          i = 0
          while i < 60:
              collMan.create_collection(CollectionSpec("collection" + str(i)))
              print("Create Coll: collection" + str(i))
              i = i + 1
       
          i = 0
          while i < 60:
              j = 0
              while j < 2500:
                  coll = cb.collection("collection" + str(i))
                  print("set: collection" + str(i) + " key" + str(j))
                  coll.upsert("collection" + str(i) + "-key" + str(j), '{"key":"value1"}')
                  j = j + 1
              i = i + 1
       
          i = 0
          j = 0
          while i < 60:
              j = 0
              while j < 2500:
                  coll = cb.collection("collection" + str(i))
                  print("update: collection" + str(i) + " key" + str(j))
                  coll.upsert("collection" + str(i) + "-key" + str(j), '{"key":"value2"}')
                  j = j + 1
              i = i + 1
          #input("SET DONE")
          i = 0
          while i < 60:
              collMan.drop_collection(CollectionSpec("collection" + str(i)))
              print("Drop Coll: collection" + str(i))
              i = i + 1
       
          run = run + 1
      input("WAAIT")
      

        Couchbase Protocol, Set Request, Opcode: 0x1, VBucket: 0x35a
             Magic: Request (0x80)
            Opcode: Set (0x01)
            Key Length: 18
            Extras Length: 8
            Data Type: 0x00
            VBucket: 858 (0x035a)
            [Value Length: 22]
            Total Body Length: 48
            Opaque: 0x0004f612
            CAS: 0x0000000000000000
            Extras
                Flags: 0x02000000
                Expiration: 0
            Key: 
                Collection ID: 0x00000000
                Collection Logical Key: collection10-key0
            Value: "{\"key\":\"value1\"}"
      

      It's worth noting that this only ever seems to effect the first key in the collection being written (see attached screenshot).

      Attachments

        1. main.py
          2 kB
        2. screenshot-1.png
          screenshot-1.png
          143 kB

        Issue Links

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

          Activity

            People

              reilbert Richard Eilbert
              richard.demellow Richard deMellow
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty