Thursday, 15 September 2011

Cassandra-cql: get TransportException when creating keyspace -



Cassandra-cql: get TransportException when creating keyspace -

i new cassandra-cql , have problem when creating keyspace next code. purpose create keyspace testing , remove after test. got exception. sometime keyspace created not.

i have searched somewhere , tried increment connect_timeout did not help. please advise should do?

**cassandracql::thrift::client::transportexception:** org/jruby/rubybasicobject.java:1679:in `__send__' org/jruby/rubykernel.java:2085:in `send' def self.create_keyspace(keyspace) db = cassandracql::database.new($cassandra_host, {}, {:connect_timeout => 10000}) db.execute("create keyspace #{keyspace} strategy_class = 'simplestrategy' , strategy_options:replication_factor = 3") db.disconnect!() end def self.remove_keyspace(keyspace) db = cassandracql::database.new($cassandra_host) db.execute("drop keyspace #{keyspace}") db.disconnect!() end

system log:

info [migrationstage:1] 2013-02-22 11:01:56,526 migration.java (line 119) applying migration 996e0020-7ca4-11e2-0000-f7e85c70fcbe add together keyspace: clients, rep strategy:simplestrategy{}, durable_writes: true info [migrationstage:1] 2013-02-22 11:01:56,527 columnfamilystore.java (line 704) enqueuing flush of memtable-migrations@1366812340(86128/107660 serialized/live bytes, 1 ops) info [flushwriter:5] 2013-02-22 11:01:56,528 memtable.java (line 246) writing memtable-migrations@1366812340(86128/107660 serialized/live bytes, 1 ops) info [migrationstage:1] 2013-02-22 11:01:56,531 columnfamilystore.java (line 704) enqueuing flush of memtable-schema@382426421(82194/102742 serialized/live bytes, 12 ops) info [flushwriter:5] 2013-02-22 11:01:56,543 memtable.java (line 283) completed flushing /opt/cirrus/data/cassandra/data/system/migrations-hc-2514-data.db (86192 bytes) info [flushwriter:5] 2013-02-22 11:01:56,545 memtable.java (line 246) writing memtable-schema@382426421(82194/102742 serialized/live bytes, 12 ops) info [compactionexecutor:11] 2013-02-22 11:01:56,545 compactiontask.java (line 113) compacting [sstablereader(path='/opt/cirrus/data/cassandra/data/system/migrations-hc-2511-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/migrations-hc-2513-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/migrations-hc-2514-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/migrations-hc-2512-data.db')] info [flushwriter:5] 2013-02-22 11:01:56,564 memtable.java (line 283) completed flushing /opt/cirrus/data/cassandra/data/system/schema-hc-2514-data.db (82426 bytes) info [compactionexecutor:12] 2013-02-22 11:01:56,565 compactiontask.java (line 113) compacting [sstablereader(path='/opt/cirrus/data/cassandra/data/system/schema-hc-2512-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/schema-hc-2511-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/schema-hc-2513-data.db'), sstablereader(path='/opt/cirrus/data/cassandra/data/system/schema-hc-2514-data.db')]

temporary next function workaround:

def self.create_keyspace(keyspace, timeout) homecoming if environment.keyspace_exist?(keyspace) while !environment.keyspace_exist?(keyspace) && timeout >= 0 begin sleep(3) timeout = timeout - 3 @cassandra_db_conn.execute("create keyspace #{keyspace} strategy_class = 'simplestrategy' , strategy_options:replication_factor = 3") rescue puts "*** warning: error when creating '#{keyspace}' keyspace" end end raise "*** error: '#{keyspace}' keyspace not created in '#{timeout}' second" if timeout < 0 end

result show there 2 times getting exception.

*** warning: error when creating 'clients' keyspace *** warning: error when creating 'clients' keyspace 1 scenario (1 passed) 11 steps (11 passed) 0m10.729s

cassandra cql

No comments:

Post a Comment