Dalius Šidlauskas
Dalius Šidlauskas

Reputation: 183

Hector querySuperColumn does not match countSubColumns

I got a super column family:

Logger {
    superKey : {
        nameKey : {name1:val1, name2:val2, ..., name8945:val8945}
    }
}

Here is a code:

    ThriftSuperCfTemplate<String, String, String> stringKeyTemplate = 
            new ThriftSuperCfTemplate<String, String, String>
            (keyspace, LOGGER_COLUMN_FAMILY, 
            StringSerializer.get(), StringSerializer.get(), 
            StringSerializer.get());

    int count = stringKeyTemplate.countSubColumns(NAME_KEY, SUPER_KEY); //1

    SuperCfResult<String, String, String> nameRow = 
            stringKeyTemplate.querySuperColumn(NAME_KEY, SUPER_KEY);

    Collection<String> names =  nameRow.getColumnNames(); //2

    Assert.assertTrue(names.size()==count); //3

What I am trying to do is to fetch all column names from nameKey column family, but it returns only first 7 names {name1, name2,..., name7} (line 2) but count returns 8945 (line 1). And the assertion fails on line 3...

Upvotes: 2

Views: 224

Answers (2)

zznate
zznate

Reputation: 1908

I cannot reproduce this on the current tip in GH: https://github.com/rantav/hector/commit/1aa93e78257e86dfc73390cb9c4db52d8ed29a69

I don't think too much changed here between version 1.0.1 and master. If you could try updating to the latest from trunk and seeing if the problem 'goes away' i'll investigate further. Also, what version of Cassandra are you running? This just came up over the weekend, but it may not be the cause: https://issues.apache.org/jira/browse/CASSANDRA-3446

Are there any error logs on the server? Set the logging level for StorageProxy to debug and make sure everything coming over the wire seems right (details for tweaking logging levels: http://www.datastax.com/docs/1.0/configuration/logging_options).

Upvotes: 1

Dalius Šidlauskas
Dalius Šidlauskas

Reputation: 183

I have found this is reproducible only on particular data that I could not manually generate. However I found a workaround for my case:

    int count = stringKeyTemplate.countSubColumns(NAME_KEY, SUPER_KEY); //1

    SuperSliceQuery<String, String, String, String> query = 
          HFactory.createSuperSliceQuery(keyspace, StringSerializer.get(), 
          StringSerializer.get(), StringSerializer.get(), 
          StringSerializer.get());

    query.setColumnFamily(COLUMN_FAMILY);
    query.setKey(NAME_KEY);
    query.setRange(SUPER_KEY, SUPER_KEY, false, 1);

    QueryResult<SuperSlice<String, String, String>> result = query.execute();


    Collection<String> names = null;
    names = result.get().getColumnByName(SUPER_KEY).getColumns(); //2
    Assert.assertTrue(names.size()==count); //3

Upvotes: 0

Related Questions