Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11679

Cassandra Driver returns different number of results depending on fetchsize

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.1.15
    • Legacy/CQL
    • None
    • Normal

    Description

      I'm trying to fetch all distinct keys from a CF using cassandra-driver (2.1.7.1) and I observed some strange behavior :-

      The total distinct rows are 498 so If I perform a query get All distinctKeys It returns 503 instead of 498(five keys twice).
      But If I define the fetch size in select statement more than 498 then it returns exact 498 rows.

      And If I execute same statement on Dev-center it returns 498 rows (because the default fetch size is 5000). In `cqlsh` it returns 503 rows (because cqlsh uses fetch size=100).

      Some Additional and useful information :-
      -------------------------------------------------------
      Cassandra-2.1.13 (C)* version
      Consistency level: ONE
      local machine(ubuntu 14.04)

      Table Schema:-
      ----------------------

      CREATE TABLE sample (
           pk1 text,
           pk2 text,
          row_id uuid,
          value blob,
          PRIMARY KEY (( pk1,  pk2))
      ) WITH bloom_filter_fp_chance = 0.01
          AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
          AND comment = ''
          AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
          AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
          AND dclocal_read_repair_chance = 0.1
          AND default_time_to_live = 0
          AND gc_grace_seconds = 864000
          AND max_index_interval = 2048
          AND memtable_flush_period_in_ms = 0
          AND min_index_interval = 128
          AND read_repair_chance = 0.0
          AND speculative_retry = '99.0PERCENTILE';
      
      
      

      query :-
      ------------

      SELECT DISTINCT  pk2, pk1 FROM sample LIMIT 2147483647;
      

      Attachments

        1. 11679-2.1.txt
          2 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            varuna Varun Barala
            Benjamin Lerer
            Tom Hobbs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: