cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arya Goudarzi (JIRA)" <>
Subject [jira] Created: (CASSANDRA-1122) Lack of subcomparator_type will corrupt the keyspace in Thrift system_add_keyspace()
Date Mon, 24 May 2010 21:28:25 GMT
Lack of subcomparator_type will corrupt the keyspace in Thrift system_add_keyspace()

                 Key: CASSANDRA-1122
             Project: Cassandra
          Issue Type: Bug
          Components: Core
         Environment: CentOS 5.2 - Linux 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT
2010 x86_64 x86_64 x86_64 GNU/Linux
Thrift 2.0 with patch
PHP 5.2
            Reporter: Arya Goudarzi
             Fix For: 0.7

I had a problem earlier where I create a Keyspace by reading the default yaml config shipped
with the above cassandra package and after parsing and creating the keyspace with PHP Thrift
system_add_keysapce command, I would get 'TException: Error: Internal error processing describe_keyspace
' when trying to get describe_keyspace. In cassandra-cli I get the same error.

The cassandra log shows a null pointed exception:
ERROR [pool-1-thread-39] 2010-05-24 14:17:35,204 (line 1943) Internal error
processing describe_keyspace
	at org.apache.cassandra.thrift.CassandraServer.describe_keyspace(
	at org.apache.cassandra.thrift.Cassandra$Processor$describe_keyspace.process(
	at org.apache.cassandra.thrift.Cassandra$Processor.process(
	at org.apache.thrift.server.TThreadPoolServer$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

I traced down the problem to where I define cassandra_CfDef. When the type is Super and subcomparator_type
is not set, Thrift code does not set it to any default value but blank "". The command system_add_keyspace()
runs with no problem. Whatever happens in Cassandra afterwards, will create a useless keyspace.

Here is my code snippet to generate the exception:

$GLOBALS['THRIFT_ROOT'] = '/usr/share/php/Thrift';
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';

try {
  // Make a connection to the Thrift interface to Cassandra
  $socket = new TSocket('', 9160);
  $transport = new TBufferedTransport($socket, 1024, 1024);
  $protocol = new TBinaryProtocolAccelerated($transport);
  $client = new CassandraClient($protocol);

  //Try creating some keyspace/column family defs
  $ks = new cassandra_KsDef();
  $ks->name = 'agoudarzi_Keyspace1';
  $ks->strategy_class = 'org.apache.cassandra.locator.RackUnawareStrategy';
  $ks->replication_factor = '1';
  //Now add a column family to it
  $cf = new cassandra_CfDef();
  $cf->name = 'Super3';
  $cf->table = 'agoudarzi_Keyspace1';
  $cf->column_type = 'Super';
  $cf->comparator_type = 'LongType';
  $cf->row_cache_size = '0';
  $cf->key_cache_size = '50';
  $cf->comment = 'A column family with supercolumns, whose column names are Longs (8 bytes)';
  $ks->cf_defs[] = $cf;

  //Try to check if keyspace description is good
  $rs = $client->describe_keyspace('agoudarzi_Keyspace1');


} catch (TException $tx) {
   print 'TException: '.$tx->why. ' Error: '.$tx->getMessage() . "\n";

I think a default subcomparator should be set by thrift or other defensive method be used
to prevent this problem.

Please investigate. 


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message