You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Yang Yang (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2011/10/21 22:56:33 UTC

[jira] [Issue Comment Edited] (CASSANDRA-3390) ReadResponseSerializer.serializedSize() calculation is wrong

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

Yang Yang edited comment on CASSANDRA-3390 at 10/21/11 8:54 PM:
----------------------------------------------------------------

I mean  

buffer.getData().length  returns the underlying byte[] length, which is always doubled on expansion, so this will not be the same as the actual bytes written. actually this agrees with what we are seeing, getData().length() == (size + 1 ) * 2, because the buffer is doubled on the last write of one byte.

buffer.getLength()  returns the "count" var, yes, this should be the same as the serializedSize() calculation


                
      was (Author: yangyangyyy):
    I mean  

buffer.getData().length  returns the underlying byte[] length, which is always doubled on expansion, so this will not be the same as the actual bytes written

buffer.getLength()  returns the "count" var, yes, this should be the same as the serializedSize() calculation


                  
> ReadResponseSerializer.serializedSize() calculation is wrong
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-3390
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3390
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>            Reporter: Yang Yang
>             Fix For: 1.0.1
>
>         Attachments: 3390.patch
>
>
> in ReadResponse.java
> the following code
>     public long serializedSize(ReadResponse response, int version)
>     {
>         int size = DBConstants.intSize;
>         size += (response.isDigestQuery() ? response.digest() : ByteBufferUtil.EMPTY_BYTE_BUFFER).remaining();
>         size += DBConstants.boolSize;
>         if (response.isDigestQuery())
>             size += response.digest().remaining();
>         else
>             size += Row.serializer().serializedSize(response.row(), version);
>         return size;
>     }
> adds the digest size 2 times
> this triggers assertion error in at least ReadVerbHandler

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira