You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2014/02/24 10:04:19 UTC

[jira] [Updated] (CASSANDRA-6748) If null is explicitly set to a column, paging_state will not work

     [ https://issues.apache.org/jira/browse/CASSANDRA-6748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sylvain Lebresne updated CASSANDRA-6748:
----------------------------------------

    Attachment: 6748.txt

Paging requests a new page starting from the last cell of the previously returned result. Then, when it gets the new page, it checks if it starts with the previous last cell (likely, though not guaranteed), and if it does, it discards it (since it has been returned already). The problem is that the discarding part removes the first live CQL row, which is ok is that "previous last cell" is live, but ends up discarding the first "valid" row otherwise and that's the case here.

Simplest fix is probably just to make the check of whether the new page contains the previous last cell return false if said cell is deleted, since the rest of the paging code ignore deleted cells anyway, and attaching patch to do that (with a unit test).


> If null is explicitly set to a column, paging_state will not work
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-6748
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6748
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 2.0.5
> Ubuntu 12.04
>            Reporter: Katsutoshi Nagaoka
>            Assignee: Sylvain Lebresne
>             Fix For: 2.0.6
>
>         Attachments: 6748.txt
>
>
> If null is explicitly set to a column, paging_state will not work. My test procedure is as follows:
> ------
> Create a table and insert 10 records using cqlsh. The query is as follows:
> {code}
> CREATE TABLE mytable (id int, range int, value text, PRIMARY KEY (id, range));
> INSERT INTO mytable (id, range) VALUES (0, 0);
> INSERT INTO mytable (id, range) VALUES (0, 1);
> INSERT INTO mytable (id, range) VALUES (0, 2);
> INSERT INTO mytable (id, range) VALUES (0, 3);
> INSERT INTO mytable (id, range) VALUES (0, 4);
> INSERT INTO mytable (id, range, value) VALUES (0, 5, null);
> INSERT INTO mytable (id, range, value) VALUES (0, 6, null);
> INSERT INTO mytable (id, range, value) VALUES (0, 7, null);
> INSERT INTO mytable (id, range, value) VALUES (0, 8, null);
> INSERT INTO mytable (id, range, value) VALUES (0, 9, null);
> {code}
> Select 10 records using datastax driver. The pseudocode is as follows:
> {code}
> Statement statement = QueryBuilder.select().from("mytable").setFetchSize(1);
> ResultSet rs = session.execute(statement);
> for(Row row : rs){
>     System.out.println(String.format("id=%d, range=%d, value=%s",
>         row.getInt("id"), row.getInt("range"), row.getString("value")));
> }
> {code}
> The result is as follows:
> {code}
> id=0, range=0, value=null
> id=0, range=1, value=null
> id=0, range=2, value=null
> id=0, range=3, value=null
> id=0, range=4, value=null
> id=0, range=5, value=null
> id=0, range=7, value=null
> id=0, range=9, value=null
> {code}
> ------
> Result is 8 records although 10 records were expected. I originally raised this issue in the mailing lists: http://www.mail-archive.com/user@cassandra.apache.org/msg34752.html



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)