cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vivek Mishra <mishra.v...@gmail.com>
Subject Re: Using compound primary key
Date Tue, 09 Oct 2012 09:04:09 GMT
Keyspace: testcomp:
  Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
  Durable Writes: true
    Options: [datacenter1:1]
  Column Families:
    ColumnFamily: altercations
      Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
      Default column value validator:
org.apache.cassandra.db.marshal.UTF8Type
      Columns sorted by:
org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 0.1
      DC Local Read repair chance: 0.0
      Replicate on write: true
      Caching: KEYS_ONLY
      Bloom Filter FP chance: default
      Built indexes: []
      Compaction Strategy:
org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
      Compression Options:
        sstable_compression:
org.apache.cassandra.io.compress.SnappyCompressor


org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.DateType,org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type)

Although alliance_involvement is of "boolean" data type! which is causing
this issue.

Looks like an issue with CompositeType creation, somehow boolean is also
treated as UTF8Type.


-Vivek

On Tue, Oct 9, 2012 at 2:22 PM, Vivek Mishra <mishra.vivs@gmail.com> wrote:

> 1 strange issue with 1.1.5 .
>
>
> It works with CQL3:
>
>
> **************************************************************************************************************************************************8
> CREATE TABLE altercations (
>             ...        instigator text,
>             ...        started_at timestamp,
>             ...        ships_destroyed int,
>             ...        energy_used float,
>             ...        alliance_involvement boolean,
>             ...        PRIMARY KEY (instigator,started_at)
>             ...    );
> cqlsh:testcomp> drop columnfamily altercations;
> cqlsh:testcomp> CREATE TABLE altercations (
>             ...        instigator text,
>             ...        started_at timestamp,
>             ...        ships_destroyed int,
>             ...        energy_used float,
>             ...        alliance_involvement boolean,
>             ...        PRIMARY KEY (instigator,started_at,ships_destroyed)
>             ...    );
>
> cqlsh:testcomp>    INSERT INTO altercations (instigator, started_at,
> ships_destroyed,
>             ...                              energy_used,
> alliance_involvement)
>             ...                      VALUES ('Jayne Cobb', '2012-07-23',
> 2, 4.6, 'false');
>
> cqlsh:testcomp> select * from altercations;
>  instigator | started_at               | ships_destroyed |
> alliance_involvement | energy_used
>
> ------------+--------------------------+-----------------+----------------------+-------------
>  Jayne Cobb | 2012-07-23 00:00:00+0000 |               2 |
>  False |         4.6
>
>
> **************************************************************************************************************************************************8
>
> But after this when i try with cassandra-cli (to fetch this record):
>
> [default@testcomp] list altercations;
> Using default limit of 100
> Using default column limit of 100
> -------------------
> RowKey: Jayne Cobb
> => (column=2012-07-23 00:00:00+0530:2:alliance_involvement, value=,
> timestamp=1349772570037000)
> invalid UTF8 bytes 40933333
>
>
> gives me  {invalid UTF8 bytes 40933333}
>
>
> Not sure, whether it will behave in same way if i go with thrift java
> client?  Is this a problem CQL or thrift API?
>
> -Vivek
>
> On Tue, Oct 9, 2012 at 2:14 PM, Vivek Mishra <mishra.vivs@gmail.com>wrote:
>
>> Works fine with 1.1.5
>>
>> Thanks,
>> -Vivek
>>
>>
>> On Tue, Oct 9, 2012 at 1:59 PM, Vivek Mishra <mishra.vivs@gmail.com>wrote:
>>
>>> I am going to try it on 1.1.5
>>>
>>> In case if you can point me to changes made in between since 1.1.2 to
>>> 1.1.5 . It will be great.
>>>
>>> -Vivek
>>>
>>>
>>> On Tue, Oct 9, 2012 at 1:51 PM, Sylvain Lebresne <sylvain@datastax.com>wrote:
>>>
>>>> On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra <mishra.vivs@gmail.com>
>>>> wrote:
>>>> > Unfortunately nothing in server logs leads me to any error.
>>>>
>>>> Ok. Would you mind checking if you can reproduce against 1.1.5 if you
>>>> haven't already. If it does, do you mind opening a JIRA ticket with
>>>> the steps to reproduce?
>>>>
>>>> Thanks,
>>>> Sylvain
>>>>
>>>> >
>>>> > -Vivek
>>>> >
>>>> >
>>>> > On Tue, Oct 9, 2012 at 1:16 PM, Sylvain Lebresne <
>>>> sylvain@datastax.com>
>>>> > wrote:
>>>> >>
>>>> >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra <mishra.vivs@gmail.com>
>>>> >> wrote:
>>>> >> > Ok. I am able to understand the problem now. Issue is:
>>>> >> >
>>>> >> > If i create a column family altercations as:
>>>> >> >
>>>> >> >
>>>> >> >
>>>> **********************************************************************************************************8
>>>> >> > CREATE TABLE altercations (
>>>> >> >        instigator text,
>>>> >> >        started_at timestamp,
>>>> >> >        ships_destroyed int,
>>>> >> >        energy_used float,
>>>> >> >        alliance_involvement boolean,
>>>> >> >        PRIMARY KEY (instigator,started_at,ships_destroyed)
>>>> >> >    );
>>>> >> > /
>>>> >> >    INSERT INTO altercations (instigator, started_at,
>>>> ships_destroyed,
>>>> >> >                              energy_used, alliance_involvement)
>>>> >> >                      VALUES ('Jayne Cobb', '2012-07-23', 2,
4.6,
>>>> >> > 'false');
>>>> >> >
>>>> >> >
>>>> *********************************************************************************************************************
>>>> >> >
>>>> >> > it works!
>>>> >> >
>>>> >> > But if i create a column family with compound primary key with
2
>>>> >> > composite
>>>> >> > column as:
>>>> >> >
>>>> >> > CREATE TABLE altercations (
>>>> >> >        instigator text,
>>>> >> >        started_at timestamp,
>>>> >> >        ships_destroyed int,
>>>> >> >        energy_used float,
>>>> >> >        alliance_involvement boolean,
>>>> >> >        PRIMARY KEY (instigator,started_at)
>>>> >> >    );
>>>> >> >
>>>> >> >
>>>> >> >
>>>> *********************************************************************************************************************
>>>> >> > and Then drop this column family:
>>>> >> >
>>>> >> > drop columnfamily altercations;
>>>> >> >
>>>> >> > and then try to create same one with primary compound key with
3
>>>> >> > composite
>>>> >> > column:
>>>> >> >
>>>> >> > CREATE TABLE altercations (
>>>> >> >        instigator text,
>>>> >> >        started_at timestamp,
>>>> >> >        ships_destroyed int,
>>>> >> >        energy_used float,
>>>> >> >        alliance_involvement boolean,
>>>> >> >        PRIMARY KEY (instigator,started_at,ships_destroyed)
>>>> >> >    );
>>>> >> >
>>>> >> > it gives me error: "TSocket read 0 bytes"
>>>> >> >
>>>> >> > Rest, as no column family is created, so nothing onwards will
work.
>>>> >> >
>>>> >> > Is this an issue?
>>>> >>
>>>> >> Sounds like it yes (I mean the theory is, you shouldn't ever get
such
>>>> >> an error by creating and dropping tables. Even if you do something
>>>> >> wrong, you should get a meaningful error).
>>>> >>
>>>> >> Is there an exception in the log server side? (it's often the case
>>>> >> with a "TSocket read 0 bytes").
>>>> >>
>>>> >> --
>>>> >> Sylvain
>>>> >
>>>> >
>>>>
>>>
>>>
>>
>

Mime
View raw message