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

Sam Tunnicliffe commented on CASSANDRA-5614:
--------------------------------------------

First, we aren't doing the right thing in compaction either. Neither PCR or LCR 
clean up the index in the face of range tombstones, relying on repairs at read 
time to purge obsolete entries.
Looking into this, it also seems that PCR & LCR actually generate different 
SSTables. Although they're functionally equivalent, those that come from PCR 
don't have any columns covered by a RangeTombstone. SSTables generated by LCR 
do contain these redundant extra columns.

eg: if we have two SSTables:
{code}
[{"key": "6e697276616e61","columns": 
        [
                ["bleach:","",1374246211348000], 
                ["bleach:rating","4",1374246211348000], 
                ["bleach:release","1",1374246211348000], 
                ["nevermind:","",1374246211365000], 
                ["nevermind:rating","5",1374246211365000], 
                ["nevermind:release","2",1374246211365000]
        ]
}]

[{"key": "6e697276616e61","columns": 
        [
                ["nevermind","nevermind:!",1374246212053000,"t",1374246212]
        ]
}]
{code}

When compacted with PCR we end up with in :
{code}
[{
        "key": "6e697276616e61",
        "columns": [
                ["bleach:","",1374246658577000], 
                ["bleach:rating","4",1374246658577000], 
                ["bleach:release","1",1374246658577000], 
                ["nevermind","nevermind:!",1374246659274000,"t",1374246659]
        ]
}]
{code}

But with LCR we get:
{code}
[{
        "key": "6e697276616e61",
        "columns": [
                ["bleach:","",1374246211348000], 
                ["bleach:rating","4",1374246211348000], 
                ["bleach:release","1",1374246211348000], 
                ["nevermind","nevermind:!",1374246212053000,"t",1374246212], 
                ["nevermind:","",1374246211365000], 
                ["nevermind:rating","5",1374246211365000], 
                ["nevermind:release","2",1374246211365000]
        ]
}]
{code}

The first patch fixes PCR to clean up indexes properly.  
The second fixes LCR so that it generates SSTables like PCR & fixes its index 
cleanup. 
The third adds the index cleanup for memtable updates with RT.
                
> W/O specified columns ASPCSI does not get notified of deletes
> -------------------------------------------------------------
>
>                 Key: CASSANDRA-5614
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5614
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Benjamin Coverston
>            Assignee: Sam Tunnicliffe
>            Priority: Minor
>             Fix For: 1.2.7
>
>         Attachments: 
> 0001-CASSANDRA-5614-PreCompactedRow-updates-2i-correctly.patch, 
> 0002-CASSANDRA-5614-LazilyCompactedRow-outputs-SSTables-a.patch, 
> 0003-CASSANDRA-5614-Memtable-updates-with-RowTombstone-up.patch
>
>
> I'm working on a secondary index implementation based on the composite index 
> type.
> AbstractSimplePerColumnSecondaryIndex.java#delete is not called when CQL 
> delete statements do not specify columns.
> When I specify columns it is called. Pretty sure this is a bug.
> Setup:
> {code}
> cqlsh> create KEYSPACE foo WITH replication = {'class': 'SimpleStrategy' , 
> 'replication_factor': 1};
> cqlsh> use foo;
> cqlsh:foo> CREATE TABLE albums (artist text, album text, rating int, release 
> int, PRIMARY KEY (artist, album));
> cqlsh:foo> CREATE INDEX ON albums (rating);
> {code}
> {code}
> cqlsh:foo> insert into albums (artist, album, rating, release) VALUES 
> ('artist', 'album', 1, 2);
> {code}
> Does not get called here:
> {code}
> cqlsh:foo> DELETE FROM albums where artist='artist' and album='album';
> {code}
> {code}
> cqlsh:foo> insert into albums (artist, album, rating, release) VALUES 
> ('artist', 'album', 1, 2);
> {code}
> gets called here:
> {code}
> cqlsh:foo> DELETE rating FROM albums where artist='artist' and album='album';
> {code}

--
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

Reply via email to