Simple N1QL row iteration causes Timeout Exception

I have CB 4.5 CE. SDK 2.4.3. Single Node setup with 10G of memory. Bucket that I am querying has 1M records. All I am doing is the following (code is in Scala but Java code throws the same error too):

val params = N1qlParams.build().adhoc(false).serverSideTimeout(100000, TimeUnit.MILLISECONDS) val query = N1qlQuery.simple("select bucketname.* from `bucketname`", params) val n1QLRowIterator = couchBucket.query(query).rows() while (n1QLRowIterator.hasNext()){ val documentID = n1QLRowIterator.next().value().get("_id") }

I get the timeout exception as follows:

java.lang.RuntimeException: java.util.concurrent.TimeoutException at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:73) at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:656) at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:578)

P.S: No exception is thrown when buckets containing less than 100000 records are queried.

Increase timeout or don’t set. For 1M records fetch required more time. There might be otherways to get so many records using SDK. @ingenthr

@dagneytaggartsv sorry for the delay. Note that you are only tweaking the server side timeout, but not the client side one (so in your case you’ll get the client side timeout at the default 75s)… use .query(query, 100, TimeUnit.SECONDS) this will adjust the client and server side timeout to 100s, keeping them in sync. In general you never need to tune the server side timeout when using the blocking API, only with the async one.

1 Like