Bug with get_range_slices
-------------------------

                 Key: CASSANDRA-1505
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1505
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 0.6.5
         Environment: Java 1.6.0_21
            Reporter: Imran Ahmed


I was testing cassandra and trying to get iterate over a bunch of rows using 
the get_range_slices method.
In a loop I create small amount of data with this code:
for(int i=0;i<14;i++){
  long timestamp = System.currentTimeMillis();
  ColumnPath colPathName = new ColumnPath(CF_NAME);
  colPathName.setColumn(propName.getBytes(UTF8));
  client.insert(CASSANDRA_KEYSPACE, "my key "+i, colPathName, value, timestamp, 
ConsistencyLevel.ONE);
}

Next I try to iterate over the rows using this code:
Map<String, Map<String, byte[]>> rows = cs.getRows("", fetchSize);
                //System.out.println(rows.size()+"-ROWS="+rows);
                                
                while(!rows.isEmpty()){
                        Iterator<String> it = rows.keySet().iterator();
                        while(it.hasNext()){
                                String key = it.next();
                                System.out.println(key+"-printing 
row:"+rows.get(key));
                                if(!it.hasNext()){
                                        System.out.println("reached end of 
current page. getting next page:"+key);
                                        rows = cs.getRows(key, fetchSize);
                                        System.out.println("obtained new 
row:"+rows);
                                }
                        }
                }

the getrows method basically calls the get slice, for the key and count passed 
[I have set the predicate as per the example posted on the cassandra wiki]:
ColumnParent parent = new ColumnParent(CF_NAME);
                        List<ColumnOrSuperColumn> results = 
client.get_slice(CASSANDRA_KEYSPACE, key, parent, predicate, 
ConsistencyLevel.ONE);

This goes in an endless loop. The keys are returned randomly and I am never 
able to successfully finish the iteration.

Here's the output. It seems to move forward a little and them goes in a wild 
loop:
total slices:2
my key 0-printing row:{description...@1a786c3}
my key 1-printing row:{description...@18088c0}
reached end of current page. getting next page:my key 1
total slices:2
obtained new row:{my key 1={description...@1922221}, my key 
10={description...@fec107}}
my key 1-printing row:{description...@1922221}
my key 10-printing row:{description...@fec107}
reached end of current page. getting next page:my key 10
total slices:2
obtained new row:{my key 10={description...@132e13d}, my key 
11={description...@1617189}}
my key 10-printing row:{description...@132e13d}
my key 11-printing row:{description...@1617189}
reached end of current page. getting next page:my key 11
total slices:2
obtained new row:{my key 12={description...@64f6cd}, my key 
11={description...@872380}}
my key 12-printing row:{description...@64f6cd}
my key 11-printing row:{description...@872380}
reached end of current page. getting next page:my key 11
total slices:2
obtained new row:{my key 12={description...@2bb514}, my key 
11={description...@17d5d2a}}
my key 12-printing row:{description...@2bb514}
my key 11-printing row:{description...@17d5d2a}
reached end of current page. getting next page:my key 11
total slices:2
obtained new row:{my key 12={description...@16fa474}, my key 
11={description...@95c083}}
my key 12-printing row:{description...@16fa474}
my key 11-printing row:{description...@95c083}
reached end of current page. getting next page:my key 11
total slices:2
obtained new row:{my key 12={description...@191d8c1}, my key 
11={description...@2d9c06}}
my key 12-printing row:{description...@191d8c1}
my key 11-printing row:{description...@2d9c06}
reached end of current page. getting next page:my key 11
total slices:2
obtained new row:{my key 12={description...@5e5a50}, my key 
11={description...@7b6889}}
my key 12-printing row:{description...@5e5a50}
my key 11-printing row:{description...@7b6889}
reached end of current page. getting next page:my key 11
total slices:2
.
.
.
Shouldn't iteration work normally like other common iteration patterns or do I 
need to do things differently with casssandra to get iteration working?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to