Query doesn't always return row

Hi running 4.0 RC0 community.

I have the following code…

http://pastebin.com/A7cSsgbx

But it doesn’t seem that row returns anything my result is always 0? I have even put print statements. If I remove the index on fullName then I usually get back a result, but not always. And if I add GSI to fullName I don’t get a result.

Even with:

N1qlParams params = N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS).adhoc(false);

Hi @javadevmtl,

can you try leaving off the adhoc part or setting it to true? Prepared statements (which is what we’ll do under the covers) had some bugs in RC0 as far as I remember.

Ok I’ll try, is this fixed in enterprise?

@javadevmtl that detail will be the same in both community and enterprise. Just try with your RC0 version and adhoc to default (true).

Yeah so adhoc true seems to work and row returns, but now queries seem to timeout with just a few 100 client requests/N1QL queries and are slower alot slower.

So bassicaly I have 100 Jmeter threads/users sending to 3 load balanced vertx.io nodes which use the java SDK to connect to couch base.

With adhoc true I can generate about 400 operations per second write + 1 N1QL query and each request takes 200 milliseconds. With adHoc = false I can do about 2000 ops per second at 55ms per roundtrip.

@javadevmtl right, so prepared statements are faster, you want to wait for the final release to make it work again.

Also what you can try to get more throughput is increase the queryEndpoints on the environment, by default it’s one. Try to set it to 3 or 5 and see if it gets better.

Thanks, so how do you do set the query endpoints using java sdk?

Btw would specifying index hints manually help?

not sure about the index hints, you can send the query endpoints on the environment. See this for more info: http://developer.couchbase.com/documentation/server/4.0/sdks/java-2.2/env-config.html

I have java-client-2.2.0 and server 4.0.0-4051 Enterprise Edition (build-4051). Prepare query is still not working, i.e. with the same statement, setting adhoc to false returns empty result while setting adhoc to true returns results as expected.

Any update?

unfortunately there are still some issues with prepared statements in the 4.0 server release :neutral_face:. You should defer heavy testing of adhoc(false) to the next server release (cc. @geraldss)

Related issue: N1QL parallel queries return random empty or incomplete results