cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Yeksigian (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-5744) Cleanup AbstractType/TypeSerializer classes
Date Fri, 12 Jul 2013 01:28:47 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-5744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Carl Yeksigian updated CASSANDRA-5744:
--------------------------------------

    Attachment: 0001-Inverse-serialize-deserialize-v2.patch
    
> Cleanup AbstractType/TypeSerializer classes
> -------------------------------------------
>
>                 Key: CASSANDRA-5744
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5744
>             Project: Cassandra
>          Issue Type: Improvement
>    Affects Versions: 2.0 beta 1
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: 0001-Inverse-serialize-deserialize.txt, 0001-Inverse-serialize-deserialize-v2.patch,
0002-Make-sure-deseriaze-don-t-throw-on-empty-BB.txt, 0003-Avoid-duplicating-code.txt, 0003-Avoid-duplicating-code-v2.patch
>
>
> This is somewhat a followup to CASSANDRA-4495. I'm attaching 3 patches that do the following:
> # It inverse the serialize and deserialize method in TypeSerializer. Sorry I didn't saw
that earlier, but calling serialize the method that takes a byte array to produce an object
feels wrong to me (and wikipedia seems to agree with me that this should the other way around:
http://en.wikipedia.org/wiki/Serialization :))
> # For historical reasons (which imo were somewhat of a mistake in the first place but
that's another story), we accept an empty byte buffer as a valid value for any type. When
I say "valid", I mean that validate() never throw (except for InetAddressType as it happens,
but that's more of an inconsistency that the patch fixes). However, for some reason most deserialize
methods were just throwing a random exception if an empty byte buffer. So I think we should
be coherent here, if validate() pass, you should be able to deserialize the value alright,
and the 2nd patch make sure of that (return null when there was nothing else making sense).
> # The patch removes a bunch of code duplication. Namely, AbstracType has a getSerializer()
method that return the corresponding TypeSerializer, but despite that, every AbstractType
subclass was redefining its compose, decompose and validate that were just calling the corresponding
method in their deserializer. So the patch makes those method concrete in AbstractType and
remove the code duplication all over the place. Furthermore, TypeSerializer had a getString(ByteBuffer)
and a toString(T value) methods.  But since we also have a deserialize(ByteBuffer), the former
getString() is really not useful as it's just toString(deserialize()). So the patch also remove
that method.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message