incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris h <chris...@gmail.com>
Subject Re: PHP access to get or get_slice
Date Mon, 04 Oct 2010 04:37:06 GMT
The Clock was dropped in beta2, timestamps are back to Int64.

Ahh, my mistake!  Thanks for the correction Aaron.

Chris.

On Mon, Oct 4, 2010 at 12:29 AM, Aaron Morton <aaron@thelastpickle.com>wrote:

> The Clock was dropped in beta2, timestamps are back to Int64.
>
> As Chris says something is not getting what it expected. I'd double check
> you are using the latest generated interface, and check the exception stack
> to see if it's when the client is sending or receiving the message .
>
> If you turn logging up to DEBUG on the server you can see if your request
> makes it that far.
>
> Aaron
>
>
> On 04 Oct, 2010,at 05:17 PM, chris h <chris404@gmail.com> wrote:
>
>
> "Bad type in structure" means that some property/parameter is of an invalid
> type. e.g. a string instead of an object, an object of the wrong class, etc.
>
> One thing that jumps out at me is this line...
>
> $col->timestamp=time();
>
> I believe that all timestamps must now be defined by an instance of the cassandra_Clock
> class instead of just a raw timestamp.
>
> Try this..
>
> $clock = new cassandra_Clock();
> $clock->timestamp = time();
> $col->timestamp=$clock;
>
>
> I just got done making a little PHP high level client for Cassandra .7; a
> big help to me was to open up the various files under the $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/
> directory.  These files contain all the cassanda_* classes, so you can see
> explicitly how they work, and what they need to work.  Also the cassandra
> wiki on the API07 is a great tool.
> http://wiki.apache.org/cassandra/API07
> http://wiki.apache.org/cassandra/API
>
>
> Any problems you run into I've probably just ran into myself! :-)
>
>
> Chris.
>
>
> On Mon, Oct 4, 2010 at 12:02 AM, Kevin Withnall <kevin@ilb.com.au> wrote:
>
>> I've just installed the latest version of cassandra (0.7.0 beta 2) and
>> re-made the relevant thrift libraries.
>>
>> There doesn't seem to be many php examples around so i'm struggling to
>> get something basic to work. I had it working under 0.6.0 but had
>> other issues hence the upgrade.
>>
>> I've tried to execute 'get' as well as get_slice but theres something
>> im missing i think. the cassandra cli will show the data thats
>> inserted as the first part of this but I can't read it back.
>>
>> [default@Keyspace1] get Standard1['1']
>> => (column=656d61696c, value=foo@bar.com, timestamp=1286162622)
>> Returned 1 results.
>>
>> The error I get from php is
>> exception 'TProtocolException' with message 'Bad type in structure.'
>>
>> Any ideas would be really appreciated.
>>
>> --- cut here ---
>>     $GLOBALS['THRIFT_ROOT'] = '/var/www/cassandra';
>>     require_once
>> $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
>>     require_once
>> $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/cassandra_types.php';
>>     require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
>>     require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
>>     require_once
>> $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
>>     require_once
>> $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
>>
>>     // Make a connection to the Thrift interface to Cassandra
>>     $socket = new TSocket("127.0.0.1", 9160);
>>     $socket->setSendTimeout("10000");
>>     $socket->setRecvTimeout("10000");
>>     $transport = new TFramedTransport($socket, 10240, 10240);
>>     $protocol = new TBinaryProtocolAccelerated($transport);
>>     $client = new CassandraClient($protocol);
>>     $transport->open();
>>     $client->set_keyspace("Keyspace1");
>>
>>
>>     $col = new cassandra_Column();
>>     $col->name="email";
>>     $col->timestamp=time();
>>     $col->value="foo@bar.com";
>>
>>     $columnParent = new cassandra_ColumnParent();
>>     $columnParent->column_family = "Standard1";
>>     $columnParent->super_column = NULL;
>>
>>     $consistency_level = cassandra_ConsistencyLevel::ZERO;
>>     $key=1;
>>     $retval=$client->insert($key, $columnParent, $col,
>> $consistency_level);
>>
>>
>>     $sliceRange = new cassandra_SliceRange();
>>     $sliceRange->start = '';
>>     $sliceRange->finish = '';
>>     $predicate = new cassandra_SlicePredicate();
>>     $predicate->slice_range = $sliceRange;
>>     $consistency_level = cassandra_ConsistencyLevel::ONE;
>>     $result = $client->get_slice("Keyspace1", $key, $columnParent,
>> $predicate, $consistency_level);
>> --- cut here ---
>>
>
>

Mime
View raw message