You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Robert Wille (JIRA)" <ji...@apache.org> on 2015/10/04 07:22:26 UTC
[jira] [Commented] (CASSANDRA-10442) Paging repeats records
[ https://issues.apache.org/jira/browse/CASSANDRA-10442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14942561#comment-14942561 ]
Robert Wille commented on CASSANDRA-10442:
------------------------------------------
Don't know if anyone has looked at this yet, but I completely rewrote the ticket, and included sample code instead of just describing it. I also cleared up some of the description.
> Paging repeats records
> ----------------------
>
> Key: CASSANDRA-10442
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10442
> Project: Cassandra
> Issue Type: Bug
> Reporter: Robert Wille
>
> Paging repeats records every fetchSize records. The following sample easily reproduces the problem on Cassandra 2.0.16 with Java Driver 2.0.11.
> 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);
> }
> }
> 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)