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

Joel Knighton commented on CASSANDRA-13533:
-------------------------------------------

As a concrete example, something like the following would suffice to show the 
interning issue on all active branches.

{code}
    @Test
    public void testInterningUsesMinimalByteBuffer()
    {
        byte[] bytes = new byte[2];
        bytes[0] = 0x63;
        ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
        byteBuffer.limit(1);

        ColumnIdentifier c1 = ColumnIdentifier.getInterned(byteBuffer, 
UTF8Type.instance);

        Assert.assertEquals(2, byteBuffer.capacity());
        Assert.assertEquals(1, c1.bytes.capacity());
    }
{code}

What do you think, [~eduard.tudenhoefner]?

> ColumnIdentifier object size wrong when tables are not flushed
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-13533
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13533
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Eduard Tudenhoefner
>            Assignee: Eduard Tudenhoefner
>             Fix For: 3.0.14, 3.11.0, 4.0
>
>         Attachments: columnidentifier.png
>
>
> It turns out that the object size of {{ColumnIdentifier}} is wrong when 
> *cassandra.test.flush_local_schema_changes: false*. This looks like stuff is 
> being wrongly reused when no flush is happening.
> We only noticed this because we were using the prepared stmt cache and 
> noticed that prepared statements would account for *1-6mb* when 
> *cassandra.test.flush_local_schema_changes: false*. With 
> *cassandra.test.flush_local_schema_changes: true* (which is the default) 
> those would be around *5000 bytes*.
> Attached is a test that reproduces the problem and also a fix.
> Also after talking to [~jkni] / [~blerer] we shouldn't probably take 
> {{ColumnDefinition}} into account when measuring object sizes with 
> {{MemoryMeter}}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to