You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "bodrin (JIRA)" <ji...@apache.org> on 2014/05/03 18:41:14 UTC

[jira] [Created] (CASSANDRA-7148) Auto pagination finds 999 791 out of 1 000 000 rows

bodrin created CASSANDRA-7148:
---------------------------------

             Summary: Auto pagination finds 999 791 out of 1 000 000 rows
                 Key: CASSANDRA-7148
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7148
             Project: Cassandra
          Issue Type: Bug
            Reporter: bodrin


In a cluster of 3 nodes cassandra 2.0.6 with replication factor=3 and with the following schema:

CREATE TABLE IF NOT EXISTS test (
	org varchar,
	department varchar,
	id varchar,
	area varchar,
	value text, // json
	PRIMARY KEY ((org), department, id)
);

CREATE INDEX IF NOT EXISTS ON test(area);

I have inserted 1 000 000 rows this way:

String insert = "INSERT INTO test (org, department, id, area, value) VALUES (?, ?, ?, ?, ?)";

      for (int organization = 0; organization < 500; organization++) {
         for (int department = 0; department < 2; department++) {
            for (int area = 0; area < 2; area++) {
               for (int id = 0; id < 500; id++) {
					String orgValue = "org" + organization;
					String departmentValue = "department" + department;
					String areaValue = "area" + area;
					String idValue = UUID.randomUUID().toString();
					// insert a single row here
...

Then just read them all:

      int count = 0;
      ResultSet rs = session.execute("select * from test limit 1000000");
      Iterator<Row> i = rs.iterator();
      while (i.hasNext()) {
         Row row = i.next();
         count++;
      }
	  
and the count is 999791 (this tooks 33 seconds)

while at the same time 
cqlsh:t2> select count(*) from test limit 1000000;

 count
---------
 1000000

 I have also verified that all the queries of kind
 select * from test where area=areaXXX
 return 500 entries as expected and 2000*500 is 1 000 000



--
This message was sent by Atlassian JIRA
(v6.2#6252)