Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-1532

When cluster do not have enough data servers to support number of replicas, getAllReplicas request from Java SDK stuck until the configured kvTimeout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Critical
    • 3.0.0
    • 3.0.0-beta.1
    • Core
    • 6.5.0-4908
      SDK: 3.0.0-beta.1

    Description

      1. Create a cluster with 2 nodes and a default bucket with replica=2
      2. Load some data. 1 doc("test_docs-0") is also fine to test this issue.
      3. Do a "getAllReplicas" for that key through Java SDK
      4. Get from SDK is not released until the configured kvTimeout

      Java Code to read from all replicas:

      env = ClusterEnvironment.builder().timeoutConfig(TimeoutConfig.builder().kvTimeout(Duration.ofSeconds(5))).build();
      ClusterOptions opt = ClusterOptions.clusterOptions("Administrator", "password").environment(env);
       
      cluster = Cluster.connect("10.112.180.101",opt);
      bucket = cluster.bucket("default");
      collection = bucket.defaultCollection();
       
      long startTime;
      long stopTime;
       
      while(true) {
      	startTime = System.nanoTime();
      	Stream<GetReplicaResult> replica = collection.getAllReplicas("test_docs-0", GetAllReplicasOptions.getAllReplicasOptions());
      	replica.forEach(item ->{
      		System.out.println(item.contentAsObject());
      	});
      	stopTime = System.nanoTime();
      	System.out.println(Integer.toString(i++) + ": " +  TimeUnit.NANOSECONDS.toSeconds(stopTime - startTime));
      }
      

      5. Change the kvTimeout to 20s and observe that now the getAllReplicas is released after 20s.
      6. While the above script is running, change the bucket replica to 1 and observe that getAllReplicas started working as fast as possible.

      Attachments

        1. default.json
          14 kB
          Ritesh Agarwal
        2. getAllReplicas.pcapng
          1.74 MB
          Ritesh Agarwal
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            graham.pople Graham Pople
            ritesh.agarwal Ritesh Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty