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

Stefania commented on CASSANDRA-10001:
--------------------------------------

Reproduced with equivalent unit test which can be added to 
o.a.c.cql3.validation.entities.CollectionsTest:

{code}
    @Test
    public void testMapWithLargePartition() throws Throwable
    {
        Random r = new Random();
        long seed = System.nanoTime();
        System.out.println("Seed " + seed);
        r.setSeed(seed);

        int len = (1024 * 1024)/100;
        createTable("CREATE TABLE %s (userid text PRIMARY KEY, properties 
map<int, text>) with compression = {}");

        final int numKeys = 200;
        for (int i = 0; i < numKeys; i++)
        {
            byte[] b = new byte[len];
            r.nextBytes(b);
            execute("UPDATE %s SET properties[?] = ? WHERE userid = 'user'", i, 
new String(b));
        }

        Object[][] rows = getRows(execute("SELECT properties from %s where 
userid = 'user'"));
        assertEquals(1, rows.length);
        assertEquals(numKeys, ((Map)rows[0][0]).size());
    }
{code}

{code}
java.lang.AssertionError: 
Expected :200
Actual   :126
 <Click to see difference>
        at org.junit.Assert.failNotEquals(Assert.java:689)
        at 
org.apache.cassandra.cql3.validation.entities.CollectionsTest.testMapWithLargePartition(CollectionsTest.java:56)
{code}

> Bug in encoding of sstables
> ---------------------------
>
>                 Key: CASSANDRA-10001
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10001
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: T Jake Luciani
>            Assignee: Stefania
>            Priority: Blocker
>             Fix For: 3.0 beta 1
>
>
> Fixing the compaction dtest I noticed we aren't encoding map data correctly 
> in sstables.
> The following code fails from newly committed {{ 
> compaction_test.py:TestCompaction_with_SizeTieredCompactionStrategy.large_compaction_warning_test}}
> {code}
>  session.execute("CREATE TABLE large(userid text PRIMARY KEY, properties 
> map<int, text>) with compression = {}")
>         for i in range(200):  # ensures partition size larger than 
> compaction_large_partition_warning_threshold_mb                               
>                                                                               
>   
>             session.execute("UPDATE ks.large SET properties[%i] = '%s' WHERE 
> userid = 'user'" % (i, get_random_word(strlen)))
>         ret = session.execute("SELECT properties from ks.large where userid = 
> 'user'")
>         assert len(ret) == 1
>       self.assertEqual(200, len(ret[0][0].keys()))
> {code}
> The last assert is failing with only 91 keys.  The large values are causing 
> flushes vs staying in the memtable so the issue is somewhere in the 
> serialization of collections in sstables.



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

Reply via email to