Re: Performance drop of current Java drivers

2020-05-01 Thread Adam Holmberg
Also, if you can share your schema and benchmark code, that would be a good
start.

On Fri, May 1, 2020 at 7:09 AM Chris Splinter 
wrote:

> Hi Matthias,
>
> I have forwarded this to the developers that work on the Java driver and
> they will be looking into this first thing next week.
>
> Will circle back here with findings,
>
> Chris
>
> On Fri, May 1, 2020 at 12:28 AM Erick Ramirez 
> wrote:
>
>> Matthias, I don't have an answer to your question but I just wanted to
>> note that I don't believe the driver contributors actively watch this
>> mailing list (I'm happy to be corrected  ) so I'd recommend you
>> cross-post in the Java driver channels as well. Cheers!
>>
>

-- 
Adam Holmberg
e. adam.holmb...@datastax.com
w. www.datastax.com


Re: nulls in prepared statement & tombstones?

2016-03-09 Thread Adam Holmberg
The referenced article is accurate as far as NULL is concerned, but please
also note that there is now the ability to specify UNSET to avoid
unnecessary tombstones (as of Cassandra 2.2.0):
https://issues.apache.org/jira/browse/CASSANDRA-7304

Adam

On Tue, Mar 8, 2016 at 12:15 PM, Henry M  wrote:

> Thank you. It's probably not specific to prepared statements then and just
> a more general statement. That makes sense.
>
>
> On Tue, Mar 8, 2016 at 10:06 AM Steve Robenalt 
> wrote:
>
>> Hi Henry,
>>
>> I would suspect that the tombstones are necessary to overwrite any
>> previous values in the null'd columns. Since Cassandra avoids
>> read-before-write, there's no way to be sure that the nulls were not
>> intended to remove any such previous values, so the tombstones insure that
>> they don't re-appear.
>>
>> Steve
>>
>>
>>
>> On Tue, Mar 8, 2016 at 9:36 AM, Henry Manasseh 
>> wrote:
>>
>>> The following article makes the following statement which I am trying to
>>> understand:
>>>
>>> *"Cassandra’s storage engine is optimized to avoid storing unnecessary
>>> empty columns, but when using prepared statements those parameters that are
>>> not provided result in null values being passed to Cassandra (and thus
>>> tombstones being stored)." *
>>> http://www.datastax.com/dev/blog/4-simple-rules-when-using-the-datastax-drivers-for-cassandra
>>>
>>> I was wondering if someone could help explain why sending nulls as part
>>> of a prepared statement update would result in tombstones.
>>>
>>> Thank you,
>>> - Henry
>>>
>>
>>
>>
>> --
>> Steve Robenalt
>> Software Architect
>> sroben...@highwire.org 
>> (office/cell): 916-505-1785
>>
>> HighWire Press, Inc.
>> 425 Broadway St, Redwood City, CA 94063
>> www.highwire.org
>>
>> Technology for Scholarly Communication
>>
>


Re: How to make the result of select dateof(now) from system.local be equal to date command ?

2016-01-07 Thread Adam Holmberg
The database timestamp is UTC, which should be the same as date -u on your
system. cqlsh does not convert query results to local timezone, but it
should be easy to do in your application code.

Independent of the above, I'm a little confused by your example because I
would expect CST to be UTC - 06:00, while the example is showing UTC +
08:00. You might want to check the date settings on your local machine and
the database.

Regards,
Adam Holmberg

On Thu, Jan 7, 2016 at 1:58 AM, 土卜皿 <pengcz.n...@gmail.com> wrote:

> Hi, all
>
> When I run the command date:
>
> [root@localhost ~]# date
> Thu Jan  7 15:47:32 CST 2016
>
> But under cqlsh, I got a different time:
>
> [root@localhost ~]# cqlsh -u admin -p admin4587 172.21.0.131
> Connected to Cassandra Center at 172.21.0.131:9042.
> [cqlsh 5.0.1 | Cassandra 2.1.11 | CQL spec 3.2.1 | Native protocol v3]
> Use HELP for help.
> admin@cqlsh> select dateof(now()) from system.local;
>
> dateof(now())
> --
> 2016-01-07 07:47:32+
>
> (1 rows)
>
> What should I do for getting the same time 15:47:32 other than 07:47:32?
>
>
> Dillon Peng
>


Re: AttributeError python exception when using Models

2015-12-07 Thread Adam Holmberg
This is a good question for the Python driver mailing list
<https://groups.google.com/a/lists.datastax.com/forum/#!forum/python-driver-user>.
(changing recipients on this message)

To answer your question: this is happening because there is no connection
setup for the cqlengine mapper. When using cqlengine, you must setup the
connection before querying or using management functions:
http://datastax.github.io/python-driver/object_mapper.html#getting-started
http://datastax.github.io/python-driver/api/cassandra/cqlengine/connection.html

That said, this condition could be handled better. I've created a ticket to
improve the error message in these circumstances:
https://datastax-oss.atlassian.net/browse/PYTHON-451

Regards,
Adam Holmberg


Re: Getting code=2200 [Invalid query] message=Invalid column name ... while executing ALTER statement

2015-11-23 Thread Adam Holmberg
Michael,

Thanks for pointing that out. It is a driver issue affecting CQL export
(but not the execution API).

I created a ticket to track and resolve:
https://datastax-oss.atlassian.net/browse/PYTHON-447

Adam

On Sat, Nov 21, 2015 at 8:38 AM, Laing, Michael 
wrote:

> Quickly reviewing this spec:
> https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v4.spec
>
> I see that column_name is a utf-8 encoded string.
>
> So you should be able to pass unicode into the python driver and have it
> do the "right thing".
>
> If not, it's a bug IMHO.
>
> On Sat, Nov 21, 2015 at 8:52 AM, Laing, Michael  > wrote:
>
>> All these pain we need to take because the column names have special
 character like " ' _- ( ) '' ¬ " etc.

>>>
>> Hmm. I tried:
>>
>> cqlsh:test> create table quoted_col_name ( pk int primary key, "'_-()""¬"
>> int);
>>
>> cqlsh:test> select * from quoted_col_name;
>>
>>  *pk* | *'_-()"¬*
>>
>> +-
>> (0 rows)
>>
>>
>> So one can quote at least some chars, including all the ones you
>> mentioned.
>>
>> However, cqlsh does have a bug:
>>
>> cqlsh:test> DESCRIBE TABLE quoted_col_name
>>
>> *'ascii' codec can't decode byte 0xc2 in position 72: ordinal not in
>> range(128)*
>>
>> Anyway, perhaps you can avoid the "pain" you referenced above.
>>
>> ml
>>
>
>


Re: Error Connecting to Cassandra

2015-10-29 Thread Adam Holmberg
It's timing out at the default of two seconds while trying to query and
build the schema metadata. You can raise this timeout:
http://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Cluster.control_connection_timeout

Adam

On Thu, Oct 29, 2015 at 10:06 AM, Eduardo Alfaia 
wrote:

> I have gotten the log from the application.
>
>
>
> On 29 Oct 2015, at 06:11, Jeff Jirsa  wrote:
>
> The cassandra system.log would be more useful
>
> When Cassandra starts rejecting or dropping tcp connections, try to
> connect using cqlsh, and check the logs for indication that it’s failing.
>
> From: Eduardo Alfaia
> Reply-To: "user@cassandra.apache.org"
> Date: Wednesday, October 28, 2015 at 5:09 PM
> To: "user@cassandra.apache.org"
> Subject: Re: Error Connecting to Cassandra
>
> I am using cassandra standalone, the machine is up, I was monitoring the
> cassandra seeing the system.log but I didn’t see anything wrong.
> I’ve captured the flow of packets using wireshark and I’ve seen that the
> cassandra server is reset the connection with the client. I am sending the
> python app which I am using.
>
>
>
>


Re: how to grant permissions to OpsCenter keyspace?

2015-10-26 Thread Adam Holmberg
You need to quote the "OpsCenter" identifier to distinguish capital letters:
https://cassandra.apache.org/doc/cql3/CQL.html#identifiers

Adam

On Mon, Oct 26, 2015 at 4:25 PM, Kai Wang  wrote:

> Hi,
>
> My understanding is that if I want to enable internal authentication and
> authorization on C* while still keeping OpsCenter working, I should grant
> all to OpsCenter space and describe/select on everything else. But when I
> try to grant permissions to or even switch into OpsCenter, cqlsh reports
> this:
>
> cassandra@cqlsh> use OpsCenter;
> InvalidRequest: code=2200 [Invalid query] message="Keyspace 'opscenter'
> does not exist"
>
> KS OpsCenter of course exists. I notice cqlsh returns keyspace name in
> lower case but in system.schema_keyspaces it shows OpsCenter. C* supports
> case sensitive keyspace names in DevCenter. But cqlsh converts everything
> to lower case?
>
> How can I grant permission to OpsCenter? Or a further question, how can I
> do case sensitive operations in cqlsh?
>
> Thanks.
>


Re: Finding nodes that own a given token/partition key

2015-03-26 Thread Adam Holmberg
Dan,

Depending on your context, many of the DataStax drivers have the token ring
exposed client-side.

For example,
Python:
http://datastax.github.io/python-driver/api/cassandra/metadata.html#tokens-and-ring-topology
Java:
http://www.datastax.com/drivers/java/2.1/com/datastax/driver/core/Metadata.html

You may not have to construct this yourself.

Adam Holmberg

On Thu, Mar 26, 2015 at 3:53 PM, Roman Tkachenko ro...@mailgunhq.com
wrote:

 Hi Dan,

 Have you tried using nodetool getendpoints? It shows you nodes that
 currently own the specific key.

 Roman

 On Thu, Mar 26, 2015 at 1:21 PM, Dan Kinder dkin...@turnitin.com wrote:

 Hey all,

 In certain cases it would be useful for us to find out which node(s) have
 the data for a given token/partition key.

 The only solutions I'm aware of is to select from system.local and/or
 system.peers to grab the host_id and tokens, do `SELECT token(thing) FROM
 myks.mytable WHERE thing = 'value';`, then do the math (put the ring
 together) and figure out which node has the data. I'm assuming this is what
 token aware drivers are doing.

 Is there a simpler way to do this?

 A bit more context: we'd like to move some processing closer to data, but
 for a few reasons hadoop/spark aren't good options for the moment.





Re: FW: How to use cqlsh to access Cassandra DB if the client_encryption_options is enabled

2015-02-04 Thread Adam Holmberg
Since I don't know what's in your keystore, or how it was generated, I
don't know how much help I can be.

You probably need -alias something on the command line, and make sure a
cert by the name something exists in your keystore. You can use
keytool -list ... to examine the contents.

Adam Holmberg

On Mon, Feb 2, 2015 at 4:15 AM, Lu, Boying boying...@emc.com wrote:

 Hi, Holmberg,



 I tried your suggestion and run the following command:

 keytool –exportcert –keystore path-to-my-keystore-file –storepass
 my-keystore-password –storetype JKS –file path-to-outptfile and



 I got following error:

 keytool error: java.lang.Exception: Alias mykey does not exist



 Do you know how to fix this issue?



 Thanks



 Boying



 *From:* Adam Holmberg [mailto:adam.holmb...@datastax.com]
 *Sent:* 2015年1月31日 1:12
 *To:* user@cassandra.apache.org
 *Subject:* Re: FW: How to use cqlsh to access Cassandra DB if the
 client_encryption_options is enabled



 Assuming the truststore you are referencing is the same one the server is
 using, it's probably in the wrong format. You will need to export the cert
 into a PEM format for use in the (Python) cqlsh client. If exporting from
 the java keystore format, use



 keytool -exportcert source keystore, pass, etc -rfc -file output file



 If you have the crt file, you should be able to accomplish the same using
 openssl:



 openssl x509 -in in crt -inform DER -out output file -outform PEM



 Then, you should refer to that PEM file in your command. Alternatively,
 you can specify a path to the file (along with other options) in your
 cqlshrc file.



 References:

 How cqlsh picks up ssl options
 https://github.com/apache/cassandra/blob/cassandra-2.1/pylib/cqlshlib/sslhandling.py

 Example cqlshrc file
 https://github.com/apache/cassandra/blob/cassandra-2.1/conf/cqlshrc.sample



 Adam Holmberg



 On Wed, Jan 28, 2015 at 1:08 AM, Lu, Boying boying...@emc.com wrote:

 Hi, All,



 Does anyone know the answer?



 Thanks a lot



 Boying





 *From:* Lu, Boying
 *Sent:* 2015年1月6日 11:21
 *To:* user@cassandra.apache.org
 *Subject:* How to use cqlsh to access Cassandra DB if the
 client_encryption_options is enabled



 Hi, All,



 I turned on the dbclient_encryption_options like this:

 client_encryption_options:

 enabled: *true*

 keystore:  path-to-my-keystore-file

 keystore_password:  my-keystore-password

 truststore: path-to-my-truststore-file

 truststore_password:  my-truststore-password

 …



 I can use following cassandra-cli command to access DB:

 cassandra-cli  -ts path-to-my-truststore-file –tspw my-truststore-password
 –tf org.apache.cassandra.thrift.SSLTransportFactory



 But when I tried to access DB by cqlsh like this:

 SSL_CERTFILE=path-to-my-truststore cqlsh –t
 cqlishlib.ssl.ssl_transport_factory



 I got following error:

 Connection error: Could not connect to localhost:9160: [Errno 0]
 _ssl.c:332: error::lib(0):func(0):reason(0)



 I guess the reason maybe is that I didn’t provide the trustore password.
 But cqlsh doesn’t provide such option.



 Does anyone know how to resolve this issue?



 Thanks



 Boying







Re: Unable to create a keyspace

2015-01-30 Thread Adam Holmberg
I would first ask if you could upgrade to the latest version of Cassandra
2.1.x (presently 2.1.2).

If the issue still occurs consistently, it would be interesting to turn up
logging on the client side and see if something is causing the client to
disconnect during the metadata refresh following the schema change. If this
yields further information, please raise the issue on the driver's user
mailing list.

Adam Holmberg

On Wed, Jan 28, 2015 at 8:19 PM, Saurabh Sethi saurabh_se...@symantec.com
wrote:

 I have a 3 node Cassandra 2.1.0 cluster and I am using datastax 2.1.4
 driver to create a keyspace followed by creating a column family within
 that keyspace from my unit test.

 But I do not see the keyspace getting created and the code for creating
 column family fails because it cannot find the keyspace. I see the
 following in the system.log file:

 INFO  [SharedPool-Worker-1] 2015-01-28 17:59:08,472
 MigrationManager.java:229 - Create new Keyspace:
 KSMetaData{name=testmaxcolumnskeyspace, strategyClass=SimpleStrategy,
 strategyOptions={replication_factor=1}, cfMetaData={}, durableWrites=true,
 userTypes=org.apache.cassandra.config.UTMetaData@370ad1d3}
 INFO  [MigrationStage:1] 2015-01-28 17:59:08,476
 ColumnFamilyStore.java:856 - Enqueuing flush of schema_keyspaces: 512 (0%)
 on-heap, 0 (0%) off-heap
 INFO  [MemtableFlushWriter:22] 2015-01-28 17:59:08,477 Memtable.java:326 -
 Writing Memtable-schema_keyspaces@1664717092(138 serialized bytes, 3 ops,
 0%/0% of on/off-heap limit)
 INFO  [MemtableFlushWriter:22] 2015-01-28 17:59:08,486 Memtable.java:360 -
 Completed flushing
 /usr/share/apache-cassandra-2.1.0/bin/../data/data/system/schema_keyspaces-b0f2235744583cdb9631c43e59ce3676/system-schema_keyspaces-ka-118-Data.db
 (175 bytes) for commitlog position ReplayPosition(segmentId=1422485457803,
 position=10514)

 This issue doesn’t happen always. My test runs fine sometimes but once it
 gets into this state, it remains there for a while and I can constantly
 reproduce this.

 Also, when this issue happens for the first time, I also see the following
 error message in system.log file:

 ERROR [SharedPool-Worker-1] 2015-01-28 15:08:24,286 ErrorMessage.java:218 - 
 Unexpected exception during request
 java.io.IOException: Connection reset by peer
 at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[na:1.8.0_05]
 at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) 
 ~[na:1.8.0_05]
 at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) 
 ~[na:1.8.0_05]
 at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[na:1.8.0_05]
 at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:375) 
 ~[na:1.8.0_05]
 at 
 io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:311)
  ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:878) 
 ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:225)
  ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:114)
  ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:507) 
 ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:464)
  ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378) 
 ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350) 
 ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at 
 io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
  ~[netty-all-4.0.20.Final.jar:4.0.20.Final]
 at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]


 Anyone has any idea what might be going on here?

 Thanks,
 Saurabh



Re: FW: How to use cqlsh to access Cassandra DB if the client_encryption_options is enabled

2015-01-30 Thread Adam Holmberg
Assuming the truststore you are referencing is the same one the server is
using, it's probably in the wrong format. You will need to export the cert
into a PEM format for use in the (Python) cqlsh client. If exporting from
the java keystore format, use

keytool -exportcert source keystore, pass, etc -rfc -file output file

If you have the crt file, you should be able to accomplish the same using
openssl:

openssl x509 -in in crt -inform DER -out output file -outform PEM

Then, you should refer to that PEM file in your command. Alternatively, you
can specify a path to the file (along with other options) in your cqlshrc
file.

References:
How cqlsh picks up ssl options
https://github.com/apache/cassandra/blob/cassandra-2.1/pylib/cqlshlib/sslhandling.py
Example cqlshrc file
https://github.com/apache/cassandra/blob/cassandra-2.1/conf/cqlshrc.sample

Adam Holmberg

On Wed, Jan 28, 2015 at 1:08 AM, Lu, Boying boying...@emc.com wrote:

 Hi, All,



 Does anyone know the answer?



 Thanks a lot



 Boying





 *From:* Lu, Boying
 *Sent:* 2015年1月6日 11:21
 *To:* user@cassandra.apache.org
 *Subject:* How to use cqlsh to access Cassandra DB if the
 client_encryption_options is enabled



 Hi, All,



 I turned on the dbclient_encryption_options like this:

 client_encryption_options:

 enabled: *true*

 keystore:  path-to-my-keystore-file

 keystore_password:  my-keystore-password

 truststore: path-to-my-truststore-file

 truststore_password:  my-truststore-password

 …



 I can use following cassandra-cli command to access DB:

 cassandra-cli  -ts path-to-my-truststore-file –tspw my-truststore-password
 –tf org.apache.cassandra.thrift.SSLTransportFactory



 But when I tried to access DB by cqlsh like this:

 SSL_CERTFILE=path-to-my-truststore cqlsh –t
 cqlishlib.ssl.ssl_transport_factory



 I got following error:

 Connection error: Could not connect to localhost:9160: [Errno 0]
 _ssl.c:332: error::lib(0):func(0):reason(0)



 I guess the reason maybe is that I didn’t provide the trustore password.
 But cqlsh doesn’t provide such option.



 Does anyone know how to resolve this issue?



 Thanks



 Boying





Re: [Consitency on cqlsh command prompt]

2014-12-17 Thread Adam Holmberg
This is something that could easily be improved in cqlsh. I'll get a ticket
open today.

Adam

On Wed, Dec 17, 2014 at 8:38 AM, nitin padalia padalia.ni...@gmail.com
wrote:

 Thanks! Michael.
 On Dec 17, 2014 8:02 PM, Laing, Michael michael.la...@nytimes.com
 wrote:

 http://datastax.github.io/python-driver/api/cassandra.html

 On Wed, Dec 17, 2014 at 9:27 AM, nitin padalia padalia.ni...@gmail.com
 wrote:

 Thanks! Philip/Ryan,
 Ryan I am using single Datacenter.
 Philip could you point some link where we could see those enums.
 -Nitin
 On Dec 17, 2014 7:14 PM, Philip Thompson philip.thomp...@datastax.com
 wrote:

 I believe the problem here is that the consistency level it is showing
 you is not the number of nodes that need to respond, but the enum value
 that corresponds to QUORUM internally. If you would like, you can file an
 improvement request on the Apache Cassandra Jira.

 On Wed, Dec 17, 2014 at 12:47 AM, nitin padalia 
 padalia.ni...@gmail.com wrote:

 Hi,

 When I set Consistency to QUORUM in cqlsh command line. It says
 consistency is set to quorum.

 cqlsh:testdb CONSISTENCY QUORUM ;
 Consistency level set to QUORUM.

 However when I check it back using CONSISTENCY command on the prompt
 it says consistency is 4. However it should be 2 as my replication
 factor for the keyspace is 3.
 cqlsh:testdb CONSISTENCY ;
 Current consistency level is 4.

 Isn't consistency QUORUM calculated by: (replication_factor/2)+1?
 Where replication_factor/2 is rounded down.

 If yes then why consistency is displayed as 4, however it should be 2
 (3/2 = 1.5 = 1)+1 = 2.

 I am using Casssandra version 2.1.2 and cqlsh 5.0.1 and CQL spec 3.2.0


 Thanks! in advance.
 Nitin Padalia




Re: getting column names

2014-12-17 Thread Adam Holmberg
Stephen,

This topic is more appropriate for the python-driver-user list:
https://groups.google.com/a/lists.datastax.com/forum/#!forum/python-driver-user

Can we pick this up there, with a little further information including your
table definition?

Adam

On Fri, Dec 12, 2014 at 1:04 PM, Stephen Jones sjo...@imageworks.com
wrote:


 Hello there -

 I'm using the python-driver to get my queried rows with a row factory
 that's a dictionary. When I get back my row list, each list item is a
 dictionary, but the keys are hashes. Is there any way use the column family
 metadata to decrypt the dictionary keys to their original column names?
 Thanks for the help.

 import cassandra
 from cassandra.cluster import Cluster
 cluster = Cluster(HOSTS)
 session = cluster.connect(POOL_NAME)
 rows = session.execute('SELECT * FROM orders_archive WHERE fruits =
 \'apples\' and veggies=\'carrots\' and drinks=\'coke\' ALLOW FILTERING')
 row[0].keys()
 [ u'6b6174616e615f7370726566', u'686f7374', u'75736572',
 u'72656e6465725f61726368697665',]

 What I need and expect is:
 row[0].keys()
 [ u'drinks',u'fruits', u'veggies', u'attr1',]

 Any thoughts?

 Thanks,
 Stephen Jones
 Email: sjo...@imageworks.com
 Ext: 7913-2579
 Current Schedule: 9a - 6p




Re: Empty cqlsh cells vs. null

2014-10-23 Thread Adam Holmberg
'null' is how cqlsh displays empty cells:
https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/formatting.py#L47-L58

On Thu, Oct 23, 2014 at 9:36 AM, DuyHai Doan doanduy...@gmail.com wrote:

 Hello Jens

 What do you mean by cqlsh explicitely writes 'null' in those cells ?
 Are you seing textual value null written in the cells ?


  Null in CQL can have 2 meanings:

 1. the column did not exist (or more precisely, has never been created)
 2. the column did exist sometimes in the past (has been created) but then
 has been deleted (tombstones)



 On Thu, Oct 23, 2014 at 8:37 AM, Jens Rantil jens.ran...@tink.se wrote:

  Hi,

 Not sure this is a Datastax specific question to be asked elsewhere. In
 that case, let me know.

 Anyway, I have populated a Cassandra table from DSE Hive. When I fire up
 cqlsh and execute a SELECT against the table I have columns of INT type
 that are empty. At first I thought these were null, but it turns out that
 cqlsh explicitly writes null in those cells. What can I make of this? A
 bug in Hive serialization to Cassandra?

 Cheers,
 Jens

 —
 Sent from Mailbox https://www.dropbox.com/mailbox





Re: cassandra 2.1.0 unable to use cqlsh

2014-09-22 Thread Adam Holmberg
cqlsh in Cassandra 2.1.0 uses the DataStax python driver. The
cassandra.metadata module is provided by this package. By default it uses
the driver from an archive included in the Cassandra distribution
(.../lib/cassandra-driver-internal-only-2.1.0.zip).

See /usr/local/apache-cassandra-2.1.0/bin/cqlsh for how everything gets
setup -- it's possible your wrapper or environment are not playing well
with that.

Also note that 9160 will not apply anymore since this driver uses the
native protocol (9042).

Adam

On Sun, Sep 21, 2014 at 7:53 PM, Tim Dunphy bluethu...@gmail.com wrote:

 Hey all,

  I've just upgraded to the latest cassandra on my site with version 2.1.0.

 But now when I run the command I am getting the following error:

 [root@beta-new:/usr/local] #cqlsh
 Traceback (most recent call last):
   File /etc/alternatives/cassandrahome/bin/cqlsh-old, line 113, in
 module
 from cqlshlib import cqlhandling, cql3handling, pylexotron
   File
 /usr/local/apache-cassandra-2.1.0/bin/../pylib/cqlshlib/cql3handling.py,
 line 18, in module
 from cassandra.metadata import maybe_escape_name
 ImportError: No module named cassandra.metadata

 Just to clarify some of the above output, all my 'cqlsh' command does is
 automatically fill in some values I'd like to use as defaults and then
 invoke the real command which I've named 'cqlsh-old'. Just a quirk of my
 setup that's always allowed cqlsh to be invoked without issue across
 multiple upgrades.

 [root@beta-new:/usr/local] #cat /etc/alternatives/cassandrahome/bin/cqlsh
 #!/bin/sh
 /etc/alternatives/cassandrahome/bin/cqlsh-old beta-new.mydomain.com 9160
 --cqlversion=3.0.0

 I'd appreciate any advice you  could spare on how to get around this error!

 Thanks
 Tim

 --
 GPG me!!

 gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B




Re: cqlsh 2.1 to cassandra 2.0.7

2014-09-18 Thread Adam Holmberg
There is now a ticket open to look into this and produce a more informative
error message:
https://datastax-oss.atlassian.net/browse/PYTHON-157

Adam

On Wed, Sep 17, 2014 at 4:47 PM, Adam Holmberg adam.holmb...@datastax.com
wrote:

 This is not really supported. Presently cqlsh hard-codes CQL and protocol
 to versions only supported in 2.1:

 https://github.com/apache/cassandra/blob/cassandra-2.1.0/bin/cqlsh#L144-L147

 Your best bet is probably downloading a 2.0.x tarball and running out of
 there.

 Adam Holmberg

 On Wed, Sep 17, 2014 at 4:33 PM, Tyler Tolley thattolley...@gmail.com
 wrote:

 Just upgraded cassandra to 2.1 on my own box and when I try to connect to
 our server running 2.0.7, I get the following error.

 Connection error: ('Unable to connect to any servers', {'10.0.16.144':
 ConnectionShutdown('Connection AsyncoreConnection(25708560)
 10.0.16.144:9042 (closed) is already closed',)})

 With debug on I get the following output.

 Using CQL driver: module 'cassandra' from
 '/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.0.post.zip/cassandra-driver-2.1.0.post/cassandra/__init__.py'
 Connection error: ('Unable to connect to any servers', {'10.0.16.144':
 ConnectionShutdown('Connection AsyncoreConnection(26384400)
 10.0.16.144:9042 (closed) is already closed',)})

 If I try to connect using an earlier version of cqlsh, it connects fine.
 Anyone seen this before or have any advice on how to dig into the problem
 further? Thanks,
  -Tyler





Re: cqlsh 2.1 to cassandra 2.0.7

2014-09-17 Thread Adam Holmberg
This is not really supported. Presently cqlsh hard-codes CQL and protocol
to versions only supported in 2.1:
https://github.com/apache/cassandra/blob/cassandra-2.1.0/bin/cqlsh#L144-L147

Your best bet is probably downloading a 2.0.x tarball and running out of
there.

Adam Holmberg

On Wed, Sep 17, 2014 at 4:33 PM, Tyler Tolley thattolley...@gmail.com
wrote:

 Just upgraded cassandra to 2.1 on my own box and when I try to connect to
 our server running 2.0.7, I get the following error.

 Connection error: ('Unable to connect to any servers', {'10.0.16.144':
 ConnectionShutdown('Connection AsyncoreConnection(25708560)
 10.0.16.144:9042 (closed) is already closed',)})

 With debug on I get the following output.

 Using CQL driver: module 'cassandra' from
 '/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.0.post.zip/cassandra-driver-2.1.0.post/cassandra/__init__.py'
 Connection error: ('Unable to connect to any servers', {'10.0.16.144':
 ConnectionShutdown('Connection AsyncoreConnection(26384400)
 10.0.16.144:9042 (closed) is already closed',)})

 If I try to connect using an earlier version of cqlsh, it connects fine.
 Anyone seen this before or have any advice on how to dig into the problem
 further? Thanks,
  -Tyler




Re: select * from table in CQLSH

2014-08-13 Thread Adam Holmberg
I think you just need to quote the Users identifier. Without quotes,
identifiers are treated as case-insensitive.
https://cassandra.apache.org/doc/cql3/CQL.html#identifiers

Adam


On Wed, Aug 13, 2014 at 9:27 AM, Tim Dunphy bluethu...@gmail.com wrote:

 Hello,

  I am trying to figure out how to do a select * from a table that's stored
 in a cassandra database.

 [root@beta-new:/home/tiezinteractive/www/cassandra] #cqlsh
 Connected to Jokefire Cluster at beta-new.jokefire.com:9160.
 [cqlsh 4.1.0 | Cassandra 2.0.6 | CQL spec 3.0.0 | Thrift protocol 19.39.0]
 Use HELP for help.
 cqlsh describe keyspaces;

 system  animals  joke_fire1  game_of_thrones  system_traces  demo

 cqlsh use demo;
 cqlsh:demo describe tables;

 Users

 cqlsh:demo select * from Users;
 *Bad Request: unconfigured columnfamily users*

 Can someone please help me with what I'm doing wrong in using this select
 statement?

 Thanks
 Tim

 --
 GPG me!!

 gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B




Re: Composite Column Query Modeling

2012-09-14 Thread Adam Holmberg
I think what you're describing might give me what I'm after, but I don't
see how I can pass different column slices in a multiget call. I may be
missing something, but it looks like you pass multiple keys but only a
singular SlicePredicate. Please let me know if that's not what you meant.

I'm aware of CQL3 collections, but I don't think they quite suite my needs
in this case.

Thanks for the suggestions!

Adam

On Fri, Sep 14, 2012 at 1:56 AM, aaron morton aa...@thelastpickle.comwrote:

 You _could_ use one wide row and do a multiget against the same row for
 different column slices. Would be less efficient than a single get against
 the row. But you could still do big contiguous column slices.

 You may get some benefit from the collections in CQL 3
 http://www.datastax.com/dev/blog/cql3_collections

 Hope that helps.


 -
 Aaron Morton
 Freelance Developer
 @aaronmorton
 http://www.thelastpickle.com

 On 14/09/2012, at 8:31 AM, Adam Holmberg adam.holmberg.l...@gmail.com
 wrote:

 I'm modeling a new application and considering the use of SuperColumn vs.
 Composite Column paradigms. I understand that SuperColumns are discouraged
 in new development, but I'm pondering a query where it seems like
 SuperColumns might be better suited.

 Consider a CF with SuperColumn layout as follows

 t = {
   k1: {
 s1: { c1:v1, c2:v2 },
 s2: { c1:v3, c2:v4 },
 s3: { c1:v5, c2:v6}
 ...
   }
   ...
 }

 Which might be modeled in CQL3:

 CREATE TABLE t (
   k text,
   s text,
   c1 text,
   c2 text,
   PRIMARY KEY (k, s)
 );

 I know that it is possible to do range slices with either approach.
 However, with SuperColumns I can do sparse slice queries with a set (list)
 of column names as the SlicePredicate. I understand that the composites API
 only returns contiguous slices, but I keep finding myself wanting to do a
 query as follows:

 SELECT * FROM t WHERE k = 'foo' AND s IN (1,3);

 The question: Is there a recommended technique for emulating sparse column
 slices in composites?

 One suggestion I've read is to get the entire range and filter client
 side. This is pretty punishing if the range is large and the second keys
 being queried are sparse. Additionally, there are enough keys being queried
 that calling once per key is undesirable.

 I also realize that I could manually composite k:s as the row key and use
 multiget, but this gives away the benefit of having these records proximate
 when range queries *are* used.

 Any input on modeling/query techniques would be appreciated.

 Regards,
 Adam Holmberg


 P.S./Sidebar:
 
 What this seems like to me is a desire for 'multiget' at the second key
 level analogous to multiget at the row key level. Is this something that
 could be implemented in the server using SlicePredicate.column_names? Is
 this just an implementation gap, or is there something technical I'm
 overlooking?





Composite Column Query Modeling

2012-09-13 Thread Adam Holmberg
I'm modeling a new application and considering the use of SuperColumn vs.
Composite Column paradigms. I understand that SuperColumns are discouraged
in new development, but I'm pondering a query where it seems like
SuperColumns might be better suited.

Consider a CF with SuperColumn layout as follows

t = {
  k1: {
s1: { c1:v1, c2:v2 },
s2: { c1:v3, c2:v4 },
s3: { c1:v5, c2:v6}
...
  }
  ...
}

Which might be modeled in CQL3:

CREATE TABLE t (
  k text,
  s text,
  c1 text,
  c2 text,
  PRIMARY KEY (k, s)
);

I know that it is possible to do range slices with either approach.
However, with SuperColumns I can do sparse slice queries with a set (list)
of column names as the SlicePredicate. I understand that the composites API
only returns contiguous slices, but I keep finding myself wanting to do a
query as follows:

SELECT * FROM t WHERE k = 'foo' AND s IN (1,3);

The question: Is there a recommended technique for emulating sparse column
slices in composites?

One suggestion I've read is to get the entire range and filter client side.
This is pretty punishing if the range is large and the second keys being
queried are sparse. Additionally, there are enough keys being queried that
calling once per key is undesirable.

I also realize that I could manually composite k:s as the row key and use
multiget, but this gives away the benefit of having these records proximate
when range queries *are* used.

Any input on modeling/query techniques would be appreciated.

Regards,
Adam Holmberg


P.S./Sidebar:

What this seems like to me is a desire for 'multiget' at the second key
level analogous to multiget at the row key level. Is this something that
could be implemented in the server using SlicePredicate.column_names? Is
this just an implementation gap, or is there something technical I'm
overlooking?


StoragePort Socket Leak 0.6.5

2010-10-15 Thread Adam Holmberg
Greetings.

I'm operating a several two-node clusters (version 0.6.5) on VMs in our
development and test environments.

After about a week of operation under similar conditions, one of them
started throwing this:

WARN [main] 2010-10-12 08:08:31,245 CustomTThreadPoolServer.java (line 104)
Transport error occurred during acceptance of message.
org.apache.thrift.transport.TTransportException: java.net.SocketException:
Too many open files
at
org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:124)
at
org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35)
at
org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:31)
at
org.apache.cassandra.thrift.CustomTThreadPoolServer.serve(CustomTThreadPoolServer.java:98)
at
org.apache.cassandra.thrift.CassandraDaemon.start(CassandraDaemon.java:186)
at
org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:227)
Caused by: java.net.SocketException: Too many open files
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at
org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:119)
... 5 more

I found that the offending node had hundreds of sockets (on the StoragePort,
between the two nodes) in CLOSE_WAIT state, which was causing new
connections to bump into the fd limit. It seems similar to what is
originally described (but never resolved) several months ago in this thread:


http://www.mail-archive.com/user@cassandra.apache.org/msg01381.html

Has anyone else encountered this problem? I am curious about what might
trigger this in one cluster and not on the others (which operate in the same
environment, and are configured similarly).

Any insight would be appreciated.

Thanks,
Adam


NullPointerException in TCP Selector Manager [Cassandra 0.5.1]

2010-09-23 Thread Adam Holmberg
Hello,

I've been working with Cassandra for some time and get this error
intermittently:

ERROR [TCP Selector Manager] 2010-09-23 08:42:18,138 service.CassandraDaemon
Fatal exception in thread Thread[TCP Selector Manager,5,main]
java.lang.NullPointerException
at
org.apache.cassandra.net.TcpConnection.resumeStreaming(TcpConnection.java:268)
at
org.apache.cassandra.net.TcpConnection.connect(TcpConnection.java:354)
at
org.apache.cassandra.net.SelectorManager.doProcess(SelectorManager.java:143)
at
org.apache.cassandra.net.SelectorManager.run(SelectorManager.java:2107)

Unfortunately when this happens the socket is left open so clients connect,
but are never serviced. When this happens I am forced to restart the node.

We're running version 0.5.1. I know there are much newer versions, but we
have been frozen on this for various reasons.

I am wondering if this is/was a known issue with this version, or if I am
doing something wrong. My searches thus far have yielded nothing on the
matter.

Any insights would be appreciated.

Regards,
Adam