cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (Commented) (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-3390) ReadResponseSerializer.serializedSize() calculation is wrong
Date Mon, 24 Oct 2011 08:16:32 GMT


Sylvain Lebresne commented on CASSANDRA-3390:

bq.  We could try to preserve it by only skipping thie copy when the requested count == MAXINT

I don't think that would work either because If I understand correctly the problem, it's that
when we serialize, we may add a column between when we compute the serialized size and when
we do the actual serialization. The request count shouldn't make any difference here (besides,
I agree with the contrary to best-practices argument).

I'll note that I think this optimization has always been wrong, because the cf can also change
between when the column count is written in the serialization form and the actual write of
the columns. If columns are added, we're kind of fine, we'll serialize more columns that advertised
but the code will be ok. But it's possible to have a race where we actually remove columns,
because a tombstone could be gced by another thread, in which case we could have a EOFException
or something like that during deserialization (it's sufficiently unlikely that either nobody
ran into it, or got it only once and never again and so didn't report it or something).

Anyway +1 on the patch, but I believe it would be correct to commit to 0.8 too for the above
> ReadResponseSerializer.serializedSize() calculation is wrong
> ------------------------------------------------------------
>                 Key: CASSANDRA-3390
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>            Reporter: Yang Yang
>            Assignee: Jonathan Ellis
>             Fix For: 1.0.1
>         Attachments: 3390.patch, 3390.txt
> in
> 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:!default.jspa
For more information on JIRA, see:


View raw message