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

Ariel Weisberg commented on CASSANDRA-9499:
-------------------------------------------

I'm confused. Are we doing this as one commit or two? Previously I thought that 
adding varint encoding was going to be separate from removing Encoded streams.

You can get github (and git can probably do this as well) to provide you with a 
squashed commit without destroying the commit history on the development 
branch. 
https://github.com/apache/cassandra/compare/trunk...aweisberg:C-9499.diff

Using the temporary buffer isn't safe. You can construct scenarios where the 
buffer is retrieved and used twice. Once for varint and once when wrapping a 
bytebuffer at which point ensureRemaining() could clobber it. It's a dubious 
pattern in the first place. The only way to make it safe IMO is to have a list 
of buffers and return them when done.

I could fix it by calling ensure remaining before doing the encoding in BDOSS 
but that still leaves me thinking it's data corruption waiting to happen.

> Introduce writeVInt method to DataOutputStreamPlus
> --------------------------------------------------
>
>                 Key: CASSANDRA-9499
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9499
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Ariel Weisberg
>            Priority: Minor
>             Fix For: 3.0 beta 1
>
>
> CASSANDRA-8099 really could do with a writeVInt method, for both fixing 
> CASSANDRA-9498 but also efficiently encoding timestamp/deletion deltas. It 
> should be possible to make an especially efficient implementation against 
> BufferedDataOutputStreamPlus.



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

Reply via email to