[ 
https://issues.apache.org/jira/browse/CASSANDRA-8054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14167776#comment-14167776
 ] 

Aleksey Yeschenko commented on CASSANDRA-8054:
----------------------------------------------

Reopening because CASSANDRA-7923 exposed another issue. Since the cached 
Metadata object has the mutable flags EnumSet (and copy() doesn't clone it), a 
request with skipMetadata=true will add the flag for any future requests, even 
without it.

And for re-prepared statements post CASSANDRA-7923 this means that for the 
second prepare after any request with skipMetadata=true, the serializer will 
skip serializing the columns when returning the PREPARED response to the client.

One option would be to simply revert CASSANDRA-7923, but since it actually 
affects more than just that, the proper fix, IMO is to copy the flags in 
Metadata#copy(). Attaching a simple patch that does that.

> EXECUTE request with skipMetadata=false gets no metadata in response
> --------------------------------------------------------------------
>
>                 Key: CASSANDRA-8054
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8054
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Olivier Michallat
>            Assignee: Sylvain Lebresne
>             Fix For: 2.1.1
>
>         Attachments: 8054-2.1.txt, 8054-v2.txt
>
>
> This has been reported independently with the 
> [Java|https://datastax-oss.atlassian.net/browse/JAVA-482] and 
> [C++|https://datastax-oss.atlassian.net/browse/CPP-174] drivers.
> This happens under heavy load, where multiple client threads prepare and 
> execute statements in parallel. One of them sends an EXECUTE request with 
> skipMetadata=false, but the returned ROWS response has no metadata in it.
> A patch of {{Message.Dispatcher.channelRead0}} confirmed that the flag was 
> incorrectly set on the response:
> {code}
>                 logger.debug("Received: {}, v={}", request, 
> connection.getVersion());
>                 boolean skipMetadataOnRequest = false;
>                 if (request instanceof ExecuteMessage) {
>                     ExecuteMessage execute = (ExecuteMessage)request;
>                     skipMetadataOnRequest = execute.options.skipMetadata();
>                 }
>                 response = request.execute(qstate);
>                 if (request instanceof ExecuteMessage) {
>                     Rows rows = (Rows)response;
>                     boolean skipMetadataOnResponse = 
> rows.result.metadata.flags.contains(Flag.NO_METADATA);
>                     if (skipMetadataOnResponse != skipMetadataOnRequest) {
>                         logger.warn("Inconsistent skipMetadata on streamId 
> {}, was {} in request but {} in response",
>                                     request.getStreamId(),
>                                     skipMetadataOnRequest,
>                                     skipMetadataOnResponse);
>                     }
>                 }
> {code}
> We observed the warning with (false, true) during our tests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to