cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kishan Karunaratne (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-8871) Non-null paging state returned if last page
Date Thu, 26 Feb 2015 19:06:07 GMT

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

Kishan Karunaratne updated CASSANDRA-8871:
------------------------------------------
    Reproduced In: 2.1.3, 2.0.12  (was: 2.0.12, 2.1.3)
      Description: 
When retrieving the next page from the result of a simple statement, the result will return
a non-null paging state even if it's the last page of the query. This only happens if it's
the last page, and the results of the last page exactly matches the paging size.

Schema:
{noformat}
      CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 'replication_factor':
3};
      USE simplex;
      CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
      INSERT INTO test (k, v) VALUES ('a', 0);
      INSERT INTO test (k, v) VALUES ('b', 1);
      INSERT INTO test (k, v) VALUES ('c', 2);
      INSERT INTO test (k, v) VALUES ('d', 3);
      INSERT INTO test (k, v) VALUES ('e', 4);
{noformat}

Query:
{noformat}
      result  = session.execute("SELECT * FROM test", page_size: 5)

      loop do
        puts "last page? #{result.last_page?}"
        puts "page size: #{result.size}"

        result.each do |row|
          puts row
        end
        puts ""

        break if result.last_page?
        result = result.next_page
      end
{noformat}

Result:
{noformat}
      last page? false
      page size: 5
      {"k"=>"a", "v"=>0}
      {"k"=>"c", "v"=>2}
      {"k"=>"m", "v"=>12}
      {"k"=>"f", "v"=>5}
      {"k"=>"o", "v"=>14}
      
      last page? true
      page size: 0
{noformat}


  was:
When retrieving the next page from the result of a simple statement, the result will return
a non-null paging state even if it's the last page of the query. This only happens if it's
the last page, and the results of the last page exactly matches the paging size.

Schema:
{noformat}
      CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 'replication_factor':
3};
      USE simplex;
      CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
      INSERT INTO test (k, v) VALUES ('a', 0);
      INSERT INTO test (k, v) VALUES ('b', 1);
      INSERT INTO test (k, v) VALUES ('c', 2);
      INSERT INTO test (k, v) VALUES ('d', 3);
      INSERT INTO test (k, v) VALUES ('e', 4);
      INSERT INTO test (k, v) VALUES ('f', 5);
      INSERT INTO test (k, v) VALUES ('g', 6);
      INSERT INTO test (k, v) VALUES ('h', 7);
      INSERT INTO test (k, v) VALUES ('i', 8);
      INSERT INTO test (k, v) VALUES ('j', 9);
      INSERT INTO test (k, v) VALUES ('k', 10);
      INSERT INTO test (k, v) VALUES ('l', 11);
      INSERT INTO test (k, v) VALUES ('m', 12);
      INSERT INTO test (k, v) VALUES ('n', 13);
      INSERT INTO test (k, v) VALUES ('o', 14);
{noformat}

Query:
{noformat}
      result  = session.execute("SELECT * FROM test", page_size: 5)

      loop do
        puts "last page? #{result.last_page?}"
        puts "page size: #{result.size}"

        result.each do |row|
          puts row
        end
        puts ""

        break if result.last_page?
        result = result.next_page
      end
{noformat}

Result:
{noformat}
      +last page? false
      +page size: 5
      +{"k"=>"a", "v"=>0}
      +{"k"=>"c", "v"=>2}
      +{"k"=>"m", "v"=>12}
      +{"k"=>"f", "v"=>5}
      +{"k"=>"o", "v"=>14}
      +
      +last page? false
      +page size: 5
      +{"k"=>"n", "v"=>13}
      +{"k"=>"g", "v"=>6}
      +{"k"=>"e", "v"=>4}
      +{"k"=>"d", "v"=>3}
      +{"k"=>"h", "v"=>7}
      +
      +last page? false
      +page size: 5
      +{"k"=>"l", "v"=>11}
      +{"k"=>"j", "v"=>9}
      +{"k"=>"i", "v"=>8}
      +{"k"=>"k", "v"=>10}
      +{"k"=>"b", "v"=>1}
      +
      +last page? true
      +page size: 0
{noformat}



> Non-null paging state returned if last page
> -------------------------------------------
>
>                 Key: CASSANDRA-8871
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8871
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: ruby-driver 2.1.0 | C* 2.0.12 | C* 2.1.3
>            Reporter: Kishan Karunaratne
>            Assignee: Tyler Hobbs
>
> When retrieving the next page from the result of a simple statement, the result will
return a non-null paging state even if it's the last page of the query. This only happens
if it's the last page, and the results of the last page exactly matches the paging size.
> Schema:
> {noformat}
>       CREATE KEYSPACE simplex WITH replication = {'class': 'SimpleStrategy', 'replication_factor':
3};
>       USE simplex;
>       CREATE TABLE test (k text, v int, PRIMARY KEY (k, v));
>       INSERT INTO test (k, v) VALUES ('a', 0);
>       INSERT INTO test (k, v) VALUES ('b', 1);
>       INSERT INTO test (k, v) VALUES ('c', 2);
>       INSERT INTO test (k, v) VALUES ('d', 3);
>       INSERT INTO test (k, v) VALUES ('e', 4);
> {noformat}
> Query:
> {noformat}
>       result  = session.execute("SELECT * FROM test", page_size: 5)
>       loop do
>         puts "last page? #{result.last_page?}"
>         puts "page size: #{result.size}"
>         result.each do |row|
>           puts row
>         end
>         puts ""
>         break if result.last_page?
>         result = result.next_page
>       end
> {noformat}
> Result:
> {noformat}
>       last page? false
>       page size: 5
>       {"k"=>"a", "v"=>0}
>       {"k"=>"c", "v"=>2}
>       {"k"=>"m", "v"=>12}
>       {"k"=>"f", "v"=>5}
>       {"k"=>"o", "v"=>14}
>       
>       last page? true
>       page size: 0
> {noformat}



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

Mime
View raw message