RE: Using compound primary key
Did you use the "--cql3" option with the cqlsh command? From: Vivek Mishra [mailto:mishra.v...@gmail.com] Sent: Monday, October 08, 2012 7:22 PM To: user@cassandra.apache.org Subject: Using compound primary key Hi, I am trying to use compound primary key column name and i am referring to: http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 As mentioned on this example, i tried to create a column family containing compound primary key (one or more) as: CREATE TABLE altercations ( instigator text, started_at timestamp, ships_destroyed int, energy_used float, alliance_involvement boolean, PRIMARY KEY (instigator,started_at,ships_destroyed) ); And i am getting: ** TSocket read 0 bytes cqlsh:testcomp> ** Then followed by insert and select statements giving me following errors: cqlsh:testcomp>INSERT INTO altercations (instigator, started_at, ships_destroyed, ... energy_used, alliance_involvement) ... VALUES ('Jayne Cobb', '2012-07-23', 2, 4.6, 'false'); TSocket read 0 bytes cqlsh:testcomp> select * from altercations; Traceback (most recent call last): File "bin/cqlsh", line 1008, in perform_statement self.cursor.execute(statement, decoder=decoder) File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line 117, in execute response = self.handle_cql_execution_errors(doquery, prepared_q, compress) File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line 132, in handle_cql_execution_errors return executor(*args, **kwargs) File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", line 1583, in execute_cql_query self.send_execute_cql_query(query, compression) File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", line 1593, in send_execute_cql_query self._oprot.trans.flush() File "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py", line 293, in flush self.__trans.write(buf) File "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py", line 117, in write plus = self.handle.send(buff) error: [Errno 32] Broken pipe cqlsh:testcomp> Any idea? Is it a problem with CQL3 or with cassandra? P.S: I did post same query on dev group as well to get a quick response. -Vivek
Re: Using compound primary key
Certainly. As these are available with cql3 only! Example mentioned on datastax website is working fine, only difference is i tried with a compound primary key with 3 composite columns in place of 2 -Vivek On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua wrote: > ** ** > > Did you use the “--cql3” option with the cqlsh command? > > ** ** > > *From:* Vivek Mishra [mailto:mishra.v...@gmail.com] > *Sent:* Monday, October 08, 2012 7:22 PM > *To:* user@cassandra.apache.org > > *Subject:* Using compound primary key > > ** ** > > Hi, > > ** ** > > I am trying to use compound primary key column name and i am referring to: > > > http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 > > ** ** > > As mentioned on this example, i tried to create a column family containing > compound primary key (one or more) as: > > ** ** > > CREATE TABLE altercations ( > >instigator text, > >started_at timestamp, > >ships_destroyed int, > >energy_used float, > >alliance_involvement boolean, > >PRIMARY KEY (instigator,started_at,ships_destroyed) > >); > > ** ** > > And i am getting: > > ** ** > > ** > > TSocket read 0 bytes > > cqlsh:testcomp> > > ** > > ** ** > > ** ** > > Then followed by insert and select statements giving me following errors:* > *** > > ** ** > > > > > > ** ** > > cqlsh:testcomp>INSERT INTO altercations (instigator, started_at, > ships_destroyed, > > ... energy_used, > alliance_involvement) > > ... VALUES ('Jayne Cobb', '2012-07-23', > 2, 4.6, 'false'); > > TSocket read 0 bytes > > ** ** > > cqlsh:testcomp> select * from altercations; > > Traceback (most recent call last): > > File "bin/cqlsh", line 1008, in perform_statement > > self.cursor.execute(statement, decoder=decoder) > > File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", > line 117, in execute > > response = self.handle_cql_execution_errors(doquery, prepared_q, > compress) > > File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", > line 132, in handle_cql_execution_errors > > return executor(*args, **kwargs) > > File > "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", > line 1583, in execute_cql_query > > self.send_execute_cql_query(query, compression) > > File > "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", > line 1593, in send_execute_cql_query > > self._oprot.trans.flush() > > File > "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py", > line 293, in flush > > self.__trans.write(buf) > > File > "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py", > line 117, in write > > plus = self.handle.send(buff) > > error: [Errno 32] Broken pipe > > ** ** > > cqlsh:testcomp> > > ** ** > > > > > > ** ** > > ** ** > > ** ** > > Any idea? Is it a problem with CQL3 or with cassandra? > > ** ** > > P.S: I did post same query on dev group as well to get a quick response.** > ** > > ** ** > > ** ** > > -Vivek >
Re: Using compound primary key
Hey Vivek, The same thing happened to me the other day. You may be missing a component in your compound key. See this thread: http://mail-archives.apache.org/mod_mbox/cassandra-dev/201210.mbox/%3ccajhhpg20rrcajqjdnf8sf7wnhblo6j+aofksgbxyxwcoocg...@mail.gmail.com%3E I also wrote a couple blogs on it: http://brianoneill.blogspot.com/2012/09/composite-keys-connecting-dots-between.html http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html They've fixed this in the 1.2 beta, whereby it checks (at the thrift layer) to ensure you have the requisite number of components in the compound/composite key. -brian On Oct 8, 2012, at 10:32 PM, Vivek Mishra wrote: > Certainly. As these are available with cql3 only! > Example mentioned on datastax website is working fine, only difference is i > tried with a compound primary key with 3 composite columns in place of 2 > > -Vivek > > On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua wrote: > > > Did you use the “--cql3” option with the cqlsh command? > > > > From: Vivek Mishra [mailto:mishra.v...@gmail.com] > Sent: Monday, October 08, 2012 7:22 PM > To: user@cassandra.apache.org > > > Subject: Using compound primary key > > > > Hi, > > > > I am trying to use compound primary key column name and i am referring to: > > http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 > > > > As mentioned on this example, i tried to create a column family containing > compound primary key (one or more) as: > > > > CREATE TABLE altercations ( > >instigator text, > >started_at timestamp, > >ships_destroyed int, > >energy_used float, > >alliance_involvement boolean, > >PRIMARY KEY (instigator,started_at,ships_destroyed) > >); > > > > And i am getting: > > > > ** > > TSocket read 0 bytes > > cqlsh:testcomp> > > ** > > > > > > Then followed by insert and select statements giving me following errors: > > > > > > > > cqlsh:testcomp>INSERT INTO altercations (instigator, started_at, > ships_destroyed, > > ... energy_used, > alliance_involvement) > > ... VALUES ('Jayne Cobb', '2012-07-23', 2, > 4.6, 'false'); > > TSocket read 0 bytes > > > > cqlsh:testcomp> select * from altercations; > > Traceback (most recent call last): > > File "bin/cqlsh", line 1008, in perform_statement > > self.cursor.execute(statement, decoder=decoder) > > File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", > line 117, in execute > > response = self.handle_cql_execution_errors(doquery, prepared_q, compress) > > File "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", > line 132, in handle_cql_execution_errors > > return executor(*args, **kwargs) > > File > "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", > line 1583, in execute_cql_query > > self.send_execute_cql_query(query, compression) > > File > "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", > line 1593, in send_execute_cql_query > > self._oprot.trans.flush() > > File > "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py", > line 293, in flush > > self.__trans.write(buf) > > File > "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py", > line 117, in write > > plus = self.handle.send(buff) > > error: [Errno 32] Broken pipe > > > > cqlsh:testcomp> > > > > > > > > > > > > Any idea? Is it a problem with CQL3 or with cassandra? > > > > P.S: I did post same query on dev group as well to get a quick response. > > > > > > -Vivek > > -- Brian ONeill Lead Architect, Health Market Science (http://healthmarketscience.com) mobile:215.588.6024 blog: http://weblogs.java.net/blog/boneill42/ blog: http://brianoneill.blogspot.com/
Re: Using compound primary key
Hi Brian, Thanks for these references. These will surly help as i am on my way to get them integrate with-in Kundera. Surprisingly Column family itself was not created with example i was trying. Thanks again, -Vivek On Tue, Oct 9, 2012 at 8:33 AM, Brian O'Neill wrote: > Hey Vivek, > > The same thing happened to me the other day. You may be missing a > component in your compound key. > > See this thread: > > http://mail-archives.apache.org/mod_mbox/cassandra-dev/201210.mbox/%3ccajhhpg20rrcajqjdnf8sf7wnhblo6j+aofksgbxyxwcoocg...@mail.gmail.com%3E > > I also wrote a couple blogs on it: > > http://brianoneill.blogspot.com/2012/09/composite-keys-connecting-dots-between.html > > http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html > > They've fixed this in the 1.2 beta, whereby it checks (at the thrift > layer) to ensure you have the requisite number of components in the > compound/composite key. > > -brian > > > On Oct 8, 2012, at 10:32 PM, Vivek Mishra wrote: > > Certainly. As these are available with cql3 only! > Example mentioned on datastax website is working fine, only difference is > i tried with a compound primary key with 3 composite columns in place of 2 > > -Vivek > > On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua wrote: > >> ** ** >> >> Did you use the “--cql3” option with the cqlsh command? >> >> ** ** >> >> *From:* Vivek Mishra [mailto:mishra.v...@gmail.com] >> *Sent:* Monday, October 08, 2012 7:22 PM >> *To:* user@cassandra.apache.org >> >> *Subject:* Using compound primary key >> >> ** ** >> >> Hi, >> >> ** ** >> >> I am trying to use compound primary key column name and i am referring to: >> >> >> http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 >> >> ** ** >> >> As mentioned on this example, i tried to create a column family >> containing compound primary key (one or more) as: >> >> ** ** >> >> CREATE TABLE altercations ( >> >>instigator text, >> >>started_at timestamp, >> >>ships_destroyed int, >> >>energy_used float, >> >>alliance_involvement boolean, >> >>PRIMARY KEY (instigator,started_at,ships_destroyed) >> >>); >> >> ** ** >> >> And i am getting: >> >> ** ** >> >> * >> * >> >> TSocket read 0 bytes >> >> cqlsh:testcomp> >> >> * >> * >> >> ** ** >> >> ** ** >> >> Then followed by insert and select statements giving me following errors: >> >> >> ** ** >> >> >> >> >> >> ** ** >> >> cqlsh:testcomp>INSERT INTO altercations (instigator, started_at, >> ships_destroyed, >> >> ... energy_used, >> alliance_involvement) >> >> ... VALUES ('Jayne Cobb', '2012-07-23', >> 2, 4.6, 'false'); >> >> TSocket read 0 bytes >> >> ** ** >> >> cqlsh:testcomp> select * from altercations; >> >> Traceback (most recent call last): >> >> File "bin/cqlsh", line 1008, in perform_statement >> >> self.cursor.execute(statement, decoder=decoder) >> >> File >> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line >> 117, in execute >> >> response = self.handle_cql_execution_errors(doquery, prepared_q, >> compress) >> >> File >> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line >> 132, in handle_cql_execution_errors >> >> return executor(*args, **kwargs) >> >> File >> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", >> line 1583, in execute_cql_query >> >> self.send_execute_cql_query(query, compression) >> >> File >> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", >> line 1593, in send_execute_cql_query >> >> self._oprot.trans.flush() >> >> File >> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py", >> line 293, in flush >> >> self.__trans.write(buf) >> >> File >> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py", >> line 117, in write >> >> plus = self.handle.send(buff) >> >> error: [Errno 32] Broken pipe >> >> ** ** >> >> cqlsh:testcomp> >> >> ** ** >> >> >> >> >> >> ** ** >> >> ** ** >> >> ** ** >> >> Any idea? Is it a problem with CQL3 or with cassandra? >> >> ** ** >> >> P.S: I did post same query on dev group as well to get a quick response.* >> *** >> >> ** ** >> >> ** ** >> >> -Vivek >> > > > -- > Brian ONeill > Lead Architect, Health Market Sci
Re: Using compound primary key
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? -Vivek On Tue, Oct 9, 2012 at 8:42 AM, Vivek Mishra wrote: > Hi Brian, > Thanks for these references. These will surly help as i am on my way to > get them integrate with-in Kundera. > > Surprisingly Column family itself was not created with example i was > trying. > > Thanks again, > -Vivek > > On Tue, Oct 9, 2012 at 8:33 AM, Brian O'Neill wrote: > >> Hey Vivek, >> >> The same thing happened to me the other day. You may be missing a >> component in your compound key. >> >> See this thread: >> >> http://mail-archives.apache.org/mod_mbox/cassandra-dev/201210.mbox/%3ccajhhpg20rrcajqjdnf8sf7wnhblo6j+aofksgbxyxwcoocg...@mail.gmail.com%3E >> >> I also wrote a couple blogs on it: >> >> http://brianoneill.blogspot.com/2012/09/composite-keys-connecting-dots-between.html >> >> http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html >> >> They've fixed this in the 1.2 beta, whereby it checks (at the thrift >> layer) to ensure you have the requisite number of components in the >> compound/composite key. >> >> -brian >> >> >> On Oct 8, 2012, at 10:32 PM, Vivek Mishra wrote: >> >> Certainly. As these are available with cql3 only! >> Example mentioned on datastax website is working fine, only difference is >> i tried with a compound primary key with 3 composite columns in place of 2 >> >> -Vivek >> >> On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua wrote: >> >>> ** ** >>> >>> Did you use the “--cql3” option with the cqlsh command? >>> >>> ** ** >>> >>> *From:* Vivek Mishra [mailto:mishra.v...@gmail.com] >>> *Sent:* Monday, October 08, 2012 7:22 PM >>> *To:* user@cassandra.apache.org >>> >>> *Subject:* Using compound primary key >>> >>> ** ** >>> >>> Hi, >>> >>> ** ** >>> >>> I am trying to use compound primary key column name and i am referring >>> to: >>> >>> http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 >>> >>> ** ** >>> >>> As mentioned on this example, i tried to create a column family >>> containing compound primary key (one or more) as: >>> >>> ** ** >>> >>> CREATE TABLE altercations ( >>> >>>instigator text, >>> >>>started_at timestamp, >>> >>>ships_destroyed int, >>> >>>energy_used float, >>> >>>alliance_involvement boolean, >>> >>>PRIMARY KEY (instigator,started_at,ships_destroyed) >>> >>>); >>> >>> ** ** >>> >>> And i am getting: >>> >>> ** ** >>> >>> >>> ** >>> >>> TSocket read 0 bytes >>> >>> cqlsh:testcomp> >>> >>> >>> ** >>> >>> ** ** >>> >>> ** ** >>> >>> Then followed by insert and select statements giving me following errors: >>> >>> >>> ** ** >>> >>> >>> >>> >>> >>> ** ** >>> >>> cqlsh:testcomp>INSERT INTO altercations (instigator, started_at, >>> ships_destroyed, >>> >>> ... energy_used, >>> alliance_involvement) >>> >>> ... VALUES ('Jayne Cobb', '2012-07-23', >>>
Re: Using compound primary key
Unfortunately nothing in server logs leads me to any error. -Vivek On Tue, Oct 9, 2012 at 1:16 PM, Sylvain Lebresne wrote: > On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra > 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 >
Re: Using compound primary key
Also, it results in "Broken pipe" error on cqlsh. Not sure why socket connection got broken as well. -Vivek On Tue, Oct 9, 2012 at 1:20 PM, Vivek Mishra wrote: > Unfortunately nothing in server logs leads me to any error. > > -Vivek > > > On Tue, Oct 9, 2012 at 1:16 PM, Sylvain Lebresne wrote: > >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra >> 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 >> > >
Re: Using compound primary key
On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra 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
Re: Using compound primary key
On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra 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 > wrote: >> >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra >> 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 > >
Re: Using compound primary key
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 wrote: > On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra > 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 > > wrote: > >> > >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra > >> 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 > > > > >
Re: Using compound primary key
Works fine with 1.1.5 Thanks, -Vivek On Tue, Oct 9, 2012 at 1:59 PM, Vivek Mishra 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 wrote: > >> On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra >> 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 >> > wrote: >> >> >> >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra >> >> 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 >> > >> > >> > >
Re: Using compound primary key
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+ | 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 4093 gives me {invalid UTF8 bytes 4093} 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 wrote: > Works fine with 1.1.5 > > Thanks, > -Vivek > > > On Tue, Oct 9, 2012 at 1:59 PM, Vivek Mishra 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 wrote: >> >>> On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra >>> 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 >> > >>> > wrote: >>> >> >>> >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra >>> >> 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
Re: Using compound primary key
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 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+ | 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 4093 > > > gives me {invalid UTF8 bytes 4093} > > > 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 wrote: > >> Works fine with 1.1.5 >> >> Thanks, >> -Vivek >> >> >> On Tue, Oct 9, 2012 at 1:59 PM, Vivek Mishra 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 >>> wrote: >>> On Tue, Oct 9, 2012 at 9:50 AM, Vivek Mishra 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 < sylv...@datastax.com> > wrote: >> >> On Tue, Oct 9, 2012 at 8:57 AM, Vivek Mishra >> wrote: >> > Ok. I am able to understand the problem now. Issue is: >> > >> > If i create a column family altercations as: >> > >> > >> > **8 >> > CREATE TABLE altercations ( >> >instigato