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

Sylvain Lebresne updated CASSANDRA-10442:
-----------------------------------------
    Assignee: Benjamin Lerer

> Paging repeats records
> ----------------------
>
>                 Key: CASSANDRA-10442
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10442
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Robert Wille
>            Assignee: Benjamin Lerer
>
> Paging repeats records every fetchSize records. The following sample easily 
> reproduces the problem on Cassandra 2.0.16 with Java Driver 2.0.11.
> {noformat}
> public class TestPagingBug
> {
>       public static void main(String[] args)
>       {
>               Cluster.Builder builder = Cluster.builder();
>               Cluster c = builder.addContactPoints("192.168.98.190").build(); 
>         
>               Session s = c.connect();
>               
>               s.execute("CREATE KEYSPACE IF NOT EXISTS test WITH replication 
> = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 }");
>               s.execute("CREATE TABLE IF NOT EXISTS test.test_page(id INT, 
> sec BIGINT, data VARCHAR static, PRIMARY KEY ((id), sec))");
>               s.execute("INSERT INTO test.test_page (id, data) VALUES (1, 
> 'asdfasdfasdfasdfasdfasdf')");
>               
>               PreparedStatement insert = s.prepare("INSERT INTO 
> test.test_page (id, sec) VALUES (1, ?)");             
>               for (int i = 0; i < 1000; i++)
>                       s.execute(insert.bind((long) i));
>               
>               PreparedStatement select = s.prepare("SELECT sec FROM 
> test.test_page WHERE id = 1");
>               
>               long lastSec = -1;              
>               for (Row row : s.execute(select.bind().setFetchSize(300)))
>               {
>                       long sec = row.getLong("sec");
>                       if (sec == lastSec)
>                               System.out.println(String.format("Duplicated id 
> %d", sec));
>                       
>                       lastSec = sec;
>               }
>               System.exit(0);
>       }
> }
> {noformat}
> The program outputs the following:
> Duplicated id 299
> Duplicated id 598
> Duplicated id 897
> Note that the static column is required. This bug doesn't occur if you remove 
> the column from the schema.
> I realize that this may be a driver bug, but I don't really know, so I'm 
> logging it here until that can be determined.



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

Reply via email to