Uploaded image for project: 'Java Couchbase JVM Core'
  1. Java Couchbase JVM Core
  2. JVMCBC-834

[Collections] Doc creates under custom collection throws 'CollectionNotFoundException', but created in the server

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Test Blocker
    • Resolution: Fixed
    • None
    • 2.0.4, 2.1.0
    • None
    • Enterprise Edition 7.0.0 build 1318
      core-io-2.0.0.jar
      java-client-3.0.0.jar
    • 1

    Description

      Server: 7.0.0-1318

      SDK: compile group: 'com.couchbase.client', name: 'couchbase-transactions', version: '1.0.0-SNAPSHOT'

      Scenario:

      1. Single node cluster, Couchbase bucket
      2. Created scope 'gh1AxX8mHq12vMRVxt'
      3. Created collection 'tb9kzKD' under scope 'gh1AxX8mHq12vMRVxt'
      4. Load 100 documents using batch_insert operations from parallel clients

      Observation:

      Client returns `CollectionNotFoundException` for all ops, but the document is uploaded into the server successfully (Verified through UI and cbstats also says doc_count=100)

      test_docs-00000096 -> com.couchbase.client.core.error.CollectionNotFoundException: Collection [tb9kzKD] not found

      Cbstats output for created scope/collection with collection doc_count:

      # ./cbstats localhost:11210 -u Administrator -p password scopes
       manifest:scopes:                 2
       manifest:scopes:0x0:collections: 1
       manifest:scopes:0x0:name:        _default
       manifest:scopes:0x8:collections: 1
       manifest:scopes:0x8:name:        gh1AxX8mHq12vMRVxt
       manifest:uid:                    2
       
      # ./cbstats localhost:11210 -u Administrator -p password collections
       collection:0x0:items:         100
       collection:0x8:items:         0
       manifest:collection:0x0:name: _default
       manifest:collection:0x8:name: tb9kzKD
       manifest:collections:         2
       manifest:default_exists:      true
       manifest:uid:                 2

      TAF Testcase:

      epengine.basic_ops.basic_ops:
          test_doc_size,nodes_init=1,num_items=100,doc_size=256,replicas=0,doc_op=update,doc_type=json,scope=random,collection=True
      

      Note: Reproducibility is not 100%. Some times this goes through without any issues as well.

      Attachments

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

        Activity

          Ashwin Govindarajulu I think I can propose a workaround that should get you over the test blocker. You should be able to create the collection with a cluster, shut it down and then create a new cluster to use it. Of course in the future we'll be able to lift this limitation.

          Cluster cluster = Cluster.connect(
             "127.0.0.1",
            clusterOptions("Administrator", "password")
          );
           
          Bucket bucket = cluster.bucket("travel-sample");
           
          String name = UUID.randomUUID().toString().substring(0, 10);
          bucket.collections().createCollection(CollectionSpec.create(name, "_default"));
           
          cluster.disconnect();
           
          // prep done, now run ops
           
          cluster = Cluster.connect(
            "127.0.0.1",
            clusterOptions("Administrator", "password")
          );
           
          bucket = cluster.bucket("travel-sample");
           
          Collection collection = bucket.collection(name);
          System.err.println(collection.get("foo"));
           
          cluster.disconnect();
          

          daschl Michael Nitschinger added a comment - Ashwin Govindarajulu I think I can propose a workaround that should get you over the test blocker. You should be able to create the collection with a cluster, shut it down and then create a new cluster to use it. Of course in the future we'll be able to lift this limitation. Cluster cluster = Cluster.connect( "127.0.0.1", clusterOptions("Administrator", "password") );   Bucket bucket = cluster.bucket("travel-sample");   String name = UUID.randomUUID().toString().substring(0, 10); bucket.collections().createCollection(CollectionSpec.create(name, "_default"));   cluster.disconnect();   // prep done, now run ops   cluster = Cluster.connect( "127.0.0.1", clusterOptions("Administrator", "password") );   bucket = cluster.bucket("travel-sample");   Collection collection = bucket.collection(name); System.err.println(collection.get("foo"));   cluster.disconnect();

          Ashwin Govindarajulu please try the workaround and if it works lower the priority of the ticket - thanks!

          daschl Michael Nitschinger added a comment - Ashwin Govindarajulu please try the workaround and if it works lower the priority of the ticket - thanks!
          ashwin.govindarajulu Ashwin Govindarajulu added a comment - - edited

          Michael Nitschinger As discussed, we are creating the SDK Cluster object only after creating required collections for testing. Even then we hit this CollectionNotFoundException often.

          To confirm more I tried only inserting only 1 doc using the following steps:

          1. One node cluster
          2. Create Couchbase bucket
          3. Created new scope "6eM0H8caXU3FMf2p5jsoQxwzk0QJS" via REST API
          4. Created new collection "Pr-YDpLGA%ecW0c" via REST API
          5. Create SDK connection with the following code:

             System.setProperty("com.couchbase.forceIPv4", "false")
             logger = Logger.getLogger("com.couchbase.client")
             logger.setLevel(Level.SEVERE)
             for h in logger.getParent().getHandlers():
               if isinstance(h, ConsoleHandler):
                  h.setLevel(Level.SEVERE)
             cluster_env = ClusterEnvironment.builder().ioConfig(IoConfig.numKvConnections(25)) \
                           .timeoutConfig(TimeoutConfig.builder()
                                         .connectTimeout(Duration.ofSeconds(20))
                                         .kvTimeout(Duration.ofSeconds(10)))
           
             cluster_options = ClusterOptions.clusterOptions(self.username, self.password).environment(cluster_env.build())
             self.cluster = Cluster.connect(", ".join(self.hosts).replace(" ", ""), cluster_options)
             self.bucketObj = self.cluster.bucket(self.bucket_name)
             self.collection = self.bucketObj.scope(scope_name).collection(collection_name)

          Even with the following sequence of execution, I got this exception (but the document is reaching the server and inserted successfully),

          +---------------+------------------------------------------------------------------------------------------------------+
          | Create doc_Id | Exception                                                                                            |
          +---------------+------------------------------------------------------------------------------------------------------+
          | test_docs-0   | com.couchbase.client.core.error.CollectionNotFoundException: Collection [Pr-YDpLGA%ecW0c] not found. |
          +---------------+------------------------------------------------------------------------------------------------------+
          

          ashwin.govindarajulu Ashwin Govindarajulu added a comment - - edited Michael Nitschinger As discussed, we are creating the SDK Cluster object only after creating required collections for testing. Even then we hit this CollectionNotFoundException often. To confirm more I tried only inserting only 1 doc using the following steps: One node cluster Create Couchbase bucket Created new scope "6eM0H8caXU3FMf2p5jsoQxwzk0QJS" via REST API Created new collection "Pr-YDpLGA%ecW0c" via REST API Create SDK connection with the following code: System.setProperty("com.couchbase.forceIPv4", "false") logger = Logger.getLogger("com.couchbase.client") logger.setLevel(Level.SEVERE) for h in logger.getParent().getHandlers(): if isinstance(h, ConsoleHandler): h.setLevel(Level.SEVERE) cluster_env = ClusterEnvironment.builder().ioConfig(IoConfig.numKvConnections(25)) \ .timeoutConfig(TimeoutConfig.builder() .connectTimeout(Duration.ofSeconds(20)) .kvTimeout(Duration.ofSeconds(10)))   cluster_options = ClusterOptions.clusterOptions(self.username, self.password).environment(cluster_env.build()) self.cluster = Cluster.connect(", ".join(self.hosts).replace(" ", ""), cluster_options) self.bucketObj = self.cluster.bucket(self.bucket_name) self.collection = self.bucketObj.scope(scope_name).collection(collection_name) Even with the following sequence of execution, I got this exception (but the document is reaching the server and inserted successfully), +---------------+------------------------------------------------------------------------------------------------------+ | Create doc_Id | Exception | +---------------+------------------------------------------------------------------------------------------------------+ | test_docs-0 | com.couchbase.client.core.error.CollectionNotFoundException: Collection [Pr-YDpLGA%ecW0c] not found. | +---------------+------------------------------------------------------------------------------------------------------+
          daschl Michael Nitschinger added a comment - Changeset in progress http://review.couchbase.org/#/c/124108/

          Michael Nitschinger

          Reran the same test few times with the above patch.

          Not seeing the CollectionNotFoundException error with this change.

          ashwin.govindarajulu Ashwin Govindarajulu added a comment - Michael Nitschinger Reran the same test few times with the above patch. Not seeing the CollectionNotFoundException error with this change.

          People

            daschl Michael Nitschinger
            ashwin.govindarajulu Ashwin Govindarajulu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty