[
https://issues.apache.org/jira/browse/CASSANDRA-14752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17457212#comment-17457212
]
Ekaterina Dimitrova edited comment on CASSANDRA-14752 at 12/10/21, 3:35 PM:
----------------------------------------------------------------------------
Thank you both, actually Benjamin made a pass and there was also another issue
with the trunk patch that the tests didn't catch but I got side-tracked and
left to follow up on this when there is more time to work on it and not jumping
in between other tasks as it is important to do it right.
Quick suggestion - should we apply the 3.11 patch and fix the bug for our users
and open follow up ticket if you think it is really worth it to pursue
something more at this point? [~marcuse] , [~blerer] , [~benedict] , what do
you think about that?
was (Author: e.dimitrova):
Thank you both, actually Benjamin made a pass and there was also another issue
with the trunk that the tests didn't catch but I got side-tracked and left to
follow up on this when there is more time to work on it and not jumping in
between other tasks as it is important to do it right.
Quick suggestion - should we apply the 3.11 patch and fix the bug for our users
and open follow up ticket if you think it is really worth it to pursue
something more at this point? [~marcuse] , [~blerer] , [~benedict] , what do
you think about that?
> serializers/BooleanSerializer.java is using static bytebuffers which may
> cause problem for subsequent operations
> ----------------------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-14752
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14752
> Project: Cassandra
> Issue Type: Bug
> Components: Legacy/Core
> Reporter: Varun Barala
> Assignee: Ekaterina Dimitrova
> Priority: Normal
> Fix For: 3.11.x, 4.0.x, 4.x
>
> Attachments: patch, patch-modified
>
>
> [https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/serializers/BooleanSerializer.java#L26]
> It has two static Bytebuffer variables:-
> {code:java}
> private static final ByteBuffer TRUE = ByteBuffer.wrap(new byte[]{1});
> private static final ByteBuffer FALSE = ByteBuffer.wrap(new byte[]{0});{code}
> What will happen if the position of these Bytebuffers is being changed by
> some other operations? It'll affect other subsequent operations. -IMO Using
> static is not a good idea here.-
> A potential place where it can become problematic:
> [https://github.com/apache/cassandra/blob/cassandra-2.1.13/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java#L243]
> Since we are calling *`.remaining()`* It may give wrong results _i.e 0_ if
> these Bytebuffers have been used previously.
> Solution:
>
> [https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/serializers/BooleanSerializer.java#L42]
> Every time we return new bytebuffer object. Please do let me know If there
> is a better way. I'd like to contribute. Thanks!!
> {code:java}
> public ByteBuffer serialize(Boolean value)
> {
> return (value == null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER
> : value ? ByteBuffer.wrap(new byte[] {1}) : ByteBuffer.wrap(new byte[] {0});
> // false
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]