You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Marco Matarazzo <ma...@hexkeep.com> on 2012/07/07 00:37:22 UTC
Random errors using phpcassa
Greetings.
I am experiencing problems using a cassandra DB with phpcassa, but I am unable to understand if the error is on phpcassa client itself or on cassandra… As far as I understand, phpcassa just "pass" it to the thrift layer, and errors I am seeing are coming back from cassandra itself, so I guess it's some sort of cassandra problem (or, more easily, I am doing something wrong but I don't know what). I hope I'm not too far from true.
I am using CQL3 from php pages, and I wrote a class that basically wraps this behaviour:
$this->pool=new \phpcassa\Connection\ConnectionPool($keyspace,$servers);
[…yadda yadda…]
$client=$this->pool->get()->client;
$result=$client->prepare_cql_query($query,\Cassandra\Compression::NONE);
$itemid=$result->itemId;
return $client->execute_prepared_cql_query($itemid,$args);
This works ALMOST always. Sometimes, hovewere, I get "random" errors on queries that works. When I say "Query that works" it means that on error i dump on screen the value of $query and $args, and this is always a valid query that works, bot on the same page if I simply reload it, and on cqlsh -3, with the very same parameters.
Sample errors, and relative queries and CF schemas are:
===
Executing [SELECT qt FROM cargobays USING CONSISTENCY QUORUM WHERE corporation_id = ? and station_id = ? and item_id = ?] with (edd051f0-44aa-4bc3-ad08-3174abcd1a0d,1110129,10025)
error: No indexed columns present in by-columns clause with "equals" operator
cqlsh:goh_release> describe columnfamily cargobays
CREATE TABLE cargobays (
corporation_id ascii,
station_id ascii,
item_id ascii,
qt ascii,
PRIMARY KEY (corporation_id, station_id, item_id)
) WITH COMPACT STORAGE AND
comment='' AND
caching='KEYS_ONLY' AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
min_compaction_threshold=4 AND
max_compaction_threshold=32 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';
===
Executing [UPDATE agents_skill USING CONSISTENCY QUORUM SET value = ? WHERE agent_id = ? and skill = ?] with (3,b716738b-95e6-4e22-9924-5334ee7f2f5d,pilot)
error: line 1:78 mismatched input 'and' expecting EOF
cqlsh:goh_release> describe columnfamily agents_skill ;
CREATE TABLE agents_skill (
agent_id ascii,
skill ascii,
value ascii,
PRIMARY KEY (agent_id, skill)
) WITH COMPACT STORAGE AND
comment='' AND
caching='KEYS_ONLY' AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
min_compaction_threshold=4 AND
max_compaction_threshold=32 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';
We have a cluster of 3 nodes, and the keyspace is defined as follow:
CREATE KEYSPACE v_release WITH strategy_class = 'SimpleStrategy'
AND strategy_options:replication_factor = '3';
We're using (packaged) Cassandra 1.1.2 on an Ubuntu LTS 12.04.
I really hope it's something that can be sorted out, because we're pretty lost here.
Thank you.
--
Marco Matarazzo
Re: Random errors using phpcassa
Posted by Marco Matarazzo <ma...@hexkeep.com>.
In fact, phpcassa is doing his work quite well.
The error seems to be coming from cassandra, even if I still have to understand why.
More precisely, the error is on the cql query prepare. I opened a bug for it, as we discovered the same problem on 3 different clusters. Maybe is something wrong with our installation or maintenance routine, but as far as i now we're doing everything correctly, so it's a bug to me.
Il giorno 08/lug/2012, alle ore 05:00, Tyler Hobbs ha scritto:
> phpcassa doesn't actually support CQL at all yet, it just doesn't stop you from grabbing the connection and trying to run a cql query anyways. So, I would expect quite a few things to randomly break.
>
> Additionally, you need to set the CQL API version to 3.0.0 (I believe) using set_cql_version() on the connection in order to use cql3-specific behavior.
>
> On Fri, Jul 6, 2012 at 5:37 PM, Marco Matarazzo <ma...@hexkeep.com> wrote:
> Greetings.
>
> I am experiencing problems using a cassandra DB with phpcassa, but I am unable to understand if the error is on phpcassa client itself or on cassandra… As far as I understand, phpcassa just "pass" it to the thrift layer, and errors I am seeing are coming back from cassandra itself, so I guess it's some sort of cassandra problem (or, more easily, I am doing something wrong but I don't know what). I hope I'm not too far from true.
>
>
> I am using CQL3 from php pages, and I wrote a class that basically wraps this behaviour:
>
> $this->pool=new \phpcassa\Connection\ConnectionPool($keyspace,$servers);
> […yadda yadda…]
> $client=$this->pool->get()->client;
> $result=$client->prepare_cql_query($query,\Cassandra\Compression::NONE);
> $itemid=$result->itemId;
> return $client->execute_prepared_cql_query($itemid,$args);
>
> This works ALMOST always. Sometimes, hovewere, I get "random" errors on queries that works. When I say "Query that works" it means that on error i dump on screen the value of $query and $args, and this is always a valid query that works, bot on the same page if I simply reload it, and on cqlsh -3, with the very same parameters.
>
>
> Sample errors, and relative queries and CF schemas are:
>
> ===
>
> Executing [SELECT qt FROM cargobays USING CONSISTENCY QUORUM WHERE corporation_id = ? and station_id = ? and item_id = ?] with (edd051f0-44aa-4bc3-ad08-3174abcd1a0d,1110129,10025)
> error: No indexed columns present in by-columns clause with "equals" operator
>
> cqlsh:goh_release> describe columnfamily cargobays
>
> CREATE TABLE cargobays (
> corporation_id ascii,
> station_id ascii,
> item_id ascii,
> qt ascii,
> PRIMARY KEY (corporation_id, station_id, item_id)
> ) WITH COMPACT STORAGE AND
> comment='' AND
> caching='KEYS_ONLY' AND
> read_repair_chance=0.100000 AND
> gc_grace_seconds=864000 AND
> min_compaction_threshold=4 AND
> max_compaction_threshold=32 AND
> replicate_on_write='true' AND
> compaction_strategy_class='SizeTieredCompactionStrategy' AND
> compression_parameters:sstable_compression='SnappyCompressor';
>
> ===
>
> Executing [UPDATE agents_skill USING CONSISTENCY QUORUM SET value = ? WHERE agent_id = ? and skill = ?] with (3,b716738b-95e6-4e22-9924-5334ee7f2f5d,pilot)
> error: line 1:78 mismatched input 'and' expecting EOF
>
> cqlsh:goh_release> describe columnfamily agents_skill ;
>
> CREATE TABLE agents_skill (
> agent_id ascii,
> skill ascii,
> value ascii,
> PRIMARY KEY (agent_id, skill)
> ) WITH COMPACT STORAGE AND
> comment='' AND
> caching='KEYS_ONLY' AND
> read_repair_chance=0.100000 AND
> gc_grace_seconds=864000 AND
> min_compaction_threshold=4 AND
> max_compaction_threshold=32 AND
> replicate_on_write='true' AND
> compaction_strategy_class='SizeTieredCompactionStrategy' AND
> compression_parameters:sstable_compression='SnappyCompressor';
>
>
> We have a cluster of 3 nodes, and the keyspace is defined as follow:
>
> CREATE KEYSPACE v_release WITH strategy_class = 'SimpleStrategy'
> AND strategy_options:replication_factor = '3';
>
>
> We're using (packaged) Cassandra 1.1.2 on an Ubuntu LTS 12.04.
>
>
> I really hope it's something that can be sorted out, because we're pretty lost here.
>
> Thank you.
>
> --
> Marco Matarazzo
>
>
>
>
>
>
>
> --
> Tyler Hobbs
> DataStax
>
--
Marco Matarazzo
== Hex Keep ==
W: http://www.hexkeep.com
M: +39 347 8798528
E: marco.matarazzo@hexkeep.com
"You can learn more about a man
in one hour of play
than in one year of conversation.” - Plato
Re: Random errors using phpcassa
Posted by Tyler Hobbs <ty...@datastax.com>.
phpcassa doesn't actually support CQL at all yet, it just doesn't stop you
from grabbing the connection and trying to run a cql query anyways. So, I
would expect quite a few things to randomly break.
Additionally, you need to set the CQL API version to 3.0.0 (I believe)
using set_cql_version() on the connection in order to use cql3-specific
behavior.
On Fri, Jul 6, 2012 at 5:37 PM, Marco Matarazzo <marco.matarazzo@hexkeep.com
> wrote:
> Greetings.
>
> I am experiencing problems using a cassandra DB with phpcassa, but I am
> unable to understand if the error is on phpcassa client itself or on
> cassandra… As far as I understand, phpcassa just "pass" it to the thrift
> layer, and errors I am seeing are coming back from cassandra itself, so I
> guess it's some sort of cassandra problem (or, more easily, I am doing
> something wrong but I don't know what). I hope I'm not too far from true.
>
>
> I am using CQL3 from php pages, and I wrote a class that basically wraps
> this behaviour:
>
> $this->pool=new
> \phpcassa\Connection\ConnectionPool($keyspace,$servers);
> […yadda yadda…]
> $client=$this->pool->get()->client;
>
> $result=$client->prepare_cql_query($query,\Cassandra\Compression::NONE);
> $itemid=$result->itemId;
> return $client->execute_prepared_cql_query($itemid,$args);
>
> This works ALMOST always. Sometimes, hovewere, I get "random" errors on
> queries that works. When I say "Query that works" it means that on error i
> dump on screen the value of $query and $args, and this is always a valid
> query that works, bot on the same page if I simply reload it, and on cqlsh
> -3, with the very same parameters.
>
>
> Sample errors, and relative queries and CF schemas are:
>
> ===
>
> Executing [SELECT qt FROM cargobays USING CONSISTENCY QUORUM WHERE
> corporation_id = ? and station_id = ? and item_id = ?] with
> (edd051f0-44aa-4bc3-ad08-3174abcd1a0d,1110129,10025)
> error: No indexed columns present in by-columns clause with "equals"
> operator
>
> cqlsh:goh_release> describe columnfamily cargobays
>
> CREATE TABLE cargobays (
> corporation_id ascii,
> station_id ascii,
> item_id ascii,
> qt ascii,
> PRIMARY KEY (corporation_id, station_id, item_id)
> ) WITH COMPACT STORAGE AND
> comment='' AND
> caching='KEYS_ONLY' AND
> read_repair_chance=0.100000 AND
> gc_grace_seconds=864000 AND
> min_compaction_threshold=4 AND
> max_compaction_threshold=32 AND
> replicate_on_write='true' AND
> compaction_strategy_class='SizeTieredCompactionStrategy' AND
> compression_parameters:sstable_compression='SnappyCompressor';
>
> ===
>
> Executing [UPDATE agents_skill USING CONSISTENCY QUORUM SET value = ?
> WHERE agent_id = ? and skill = ?] with
> (3,b716738b-95e6-4e22-9924-5334ee7f2f5d,pilot)
> error: line 1:78 mismatched input 'and' expecting EOF
>
> cqlsh:goh_release> describe columnfamily agents_skill ;
>
> CREATE TABLE agents_skill (
> agent_id ascii,
> skill ascii,
> value ascii,
> PRIMARY KEY (agent_id, skill)
> ) WITH COMPACT STORAGE AND
> comment='' AND
> caching='KEYS_ONLY' AND
> read_repair_chance=0.100000 AND
> gc_grace_seconds=864000 AND
> min_compaction_threshold=4 AND
> max_compaction_threshold=32 AND
> replicate_on_write='true' AND
> compaction_strategy_class='SizeTieredCompactionStrategy' AND
> compression_parameters:sstable_compression='SnappyCompressor';
>
>
> We have a cluster of 3 nodes, and the keyspace is defined as follow:
>
> CREATE KEYSPACE v_release WITH strategy_class = 'SimpleStrategy'
> AND strategy_options:replication_factor = '3';
>
>
> We're using (packaged) Cassandra 1.1.2 on an Ubuntu LTS 12.04.
>
>
> I really hope it's something that can be sorted out, because we're pretty
> lost here.
>
> Thank you.
>
> --
> Marco Matarazzo
>
>
>
>
>
--
Tyler Hobbs
DataStax <http://datastax.com/>