Details
-
Bug
-
Resolution: Not a Bug
-
Critical
-
3.0.0-beta.1
-
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.