Details
-
Bug
-
Resolution: Fixed
-
Major
-
3.0.10, 3.1.0
-
None
-
1
Description
Trying to perform a scope-based query with adhoc set to false returns an IndexFailureException. However, you can do prepared statements on scopes/collections, so I think there is an issue with the way this option is being applied from the SDK.
Here is an example error message from the Java SDK logs (3.1.0):
Dec 11, 2020 4:01:34 PM com.couchbase.sdkd.cbclient.CommandResult warnAbout |
WARNING: Unknown exception encountered (for operation) future warnings will be suppressed |
com.couchbase.client.core.error.IndexFailureException: The server reported an issue with the underlying index {"completed":true,"coreId":"0x94d6efa800000002","errors":[{"code":12003,"message":"Keyspace not found in CB datastore: default:0 - cause: No bucket named 0"}],"idempotent":true,"lastDispatchedFrom":"10.100.196.49:65075","lastDispatchedTo":"172.23.111.137:8093","requestId":307,"requestType":"QueryRequest","retried":0,"service":{"operationId":"sdkd-java","queryContext":"`default`:`default`.0","statement":"PREPARE SELECT * from `0` WHERE tag = \"n1ql\" AND type = \"n1qldoc\";","type":"query"},"timeoutMs":1000,"timings":{"dispatchMicros":442632,"totalMicros":443688}} |
at com.couchbase.client.java.AsyncUtils.block(AsyncUtils.java:51) |
at com.couchbase.client.java.Scope.query(Scope.java:168) |
at com.couchbase.sdkd.cbclient.N1QLQueryCommandContext.execIter(N1QLQueryCommandContext.java:223) |
at com.couchbase.sdkd.cbclient.CommandContext.execute(CommandContext.java:327) |
at com.couchbase.sdkd.server.SdkServer.executeCommand(SdkServer.java:197) |
at com.couchbase.sdkd.server.SdkServer.handleRequest(SdkServer.java:218) |
at com.couchbase.sdkd.server.SdkServer.run(SdkServer.java:271) |
Suppressed: java.lang.Exception: The above exception was originally thrown by another thread at the following location.
|
at com.couchbase.client.core.io.netty.query.QueryChunkResponseParser.errorsToThrowable(QueryChunkResponseParser.java:148) |
at java.base/java.util.Optional.map(Optional.java:265) |
at com.couchbase.client.core.io.netty.query.QueryChunkResponseParser.error(QueryChunkResponseParser.java:117) |
at com.couchbase.client.core.io.netty.chunk.ChunkedMessageHandler.lambda$maybeCompleteResponseWithFailure$1(ChunkedMessageHandler.java:271) |
at java.base/java.util.Optional.orElseGet(Optional.java:369) |
at com.couchbase.client.core.io.netty.chunk.ChunkedMessageHandler.maybeCompleteResponseWithFailure(ChunkedMessageHandler.java:270) |
at com.couchbase.client.core.io.netty.chunk.ChunkedMessageHandler.channelRead(ChunkedMessageHandler.java:202) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) |
at com.couchbase.client.core.deps.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) |
at com.couchbase.client.core.deps.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) |
at com.couchbase.client.core.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) |
at com.couchbase.client.core.deps.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) |
at com.couchbase.client.core.deps.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) |
at com.couchbase.client.core.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) |
at com.couchbase.client.core.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) |
at com.couchbase.client.core.deps.io.netty.channel.kqueue.AbstractKQueueStreamChannel$KQueueStreamUnsafe.readReady(AbstractKQueueStreamChannel.java:544) |
at com.couchbase.client.core.deps.io.netty.channel.kqueue.AbstractKQueueChannel$AbstractKQueueUnsafe.readReady(AbstractKQueueChannel.java:382) |
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoop.processReady(KQueueEventLoop.java:211) |
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:289) |
at com.couchbase.client.core.deps.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) |
at com.couchbase.client.core.deps.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) |
at com.couchbase.client.core.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) |
at java.base/java.lang.Thread.run(Thread.java:834) |
The same query works if I set the adhoc option to true.
Attachments
Issue Links
- is cloned by
-
SCBC-274 Prepared queries on scopes fail
-
- Closed
-
For Gerrit Dashboard: JCBC-1747 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
142059,3 | JCBC-1747: Pass query_context to prepare and execute statements | master | couchbase-jvm-clients | Status: MERGED | +2 | +1 |