You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "John R. Frank" <jr...@mit.edu> on 2013/06/03 11:45:11 UTC

consistency level for "create keyspace"?

C*

When I create a keyspace with pycassa on a multi-node cluster, it takes 
some time before all the nodes know about the keyspace.

So, if I do this:

     sm = SystemManager(random.choice(server_list))
     sm.create_keyspace(keyspace, SIMPLE_STRATEGY, {'replication_factor': '1'})
     sm.close()

and then immediately pick a different node, it often will raise 
InvalidRequestException(why="Keyspace 'foo' does not exist")


Is there a better way to handle this than just avoiding immediately asking 
other nodes for the keyspace?


John

RE: consistency level for "create keyspace"?

Posted by Viktor Jevdokimov <Vi...@adform.com>.
We use describe_schema_versions thrift request:

  /**
   * for each schema version present in the cluster, returns a list of nodes at that version.
   * hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION.
   * the cluster is all on the same version if the size of the map is 1.
   */
  map<string, list<string>> describe_schema_versions()
       throws (1: InvalidRequestException ire),




Best regards / Pagarbiai

Viktor Jevdokimov
Senior Developer

Email: Viktor.Jevdokimov@adform.com
Phone: +370 5 212 3063
Fax: +370 5 261 0453

J. Jasinskio 16C,
LT-01112 Vilnius,
Lithuania



Disclaimer: The information contained in this message and attachments is intended solely for the attention and use of the named addressee and may be confidential. If you are not the intended recipient, you are reminded that the information remains the property of the sender. You must not use, disclose, distribute, copy, print or rely on this e-mail. If you have received this message in error, please contact the sender immediately and irrevocably delete this message and any copies.-----Original Message-----
From: John R. Frank [mailto:jrf@mit.edu]
Sent: Wednesday, June 5, 2013 4:28 AM
To: user@cassandra.apache.org
Subject: Re: consistency level for "create keyspace"?



Further the question below, the same thing seems to happen with
ColumnFamily:  If I make a ColumnFamily, and then don't wait long enough, an attempt to query it can fail if the particular node that gets queried does not know about it yet.  Is there something smarter to do than just try/except all such failures and sleep it off?

This is particularly cumbersome for writing tests that setup/teardown keyspaces repeatedly.

jrf



On Mon, 3 Jun 2013, John R. Frank wrote:

> C*
>
> When I create a keyspace with pycassa on a multi-node cluster, it
> takes some time before all the nodes know about the keyspace.
>
> So, if I do this:
>
>    sm = SystemManager(random.choice(server_list))
>    sm.create_keyspace(keyspace, SIMPLE_STRATEGY, {'replication_factor':
> '1'})
>    sm.close()
>
> and then immediately pick a different node, it often will raise
> InvalidRequestException(why="Keyspace 'foo' does not exist")
>
>
> Is there a better way to handle this than just avoiding immediately
> asking other nodes for the keyspace?
>
>
> John
>

Re: consistency level for "create keyspace"?

Posted by "John R. Frank" <jr...@mit.edu>.

Further the question below, the same thing seems to happen with 
ColumnFamily:  If I make a ColumnFamily, and then don't wait long enough, 
an attempt to query it can fail if the particular node that gets queried 
does not know about it yet.  Is there something smarter to do than just 
try/except all such failures and sleep it off?

This is particularly cumbersome for writing tests that setup/teardown 
keyspaces repeatedly.

jrf



On Mon, 3 Jun 2013, John R. Frank wrote:

> C*
>
> When I create a keyspace with pycassa on a multi-node cluster, it takes some 
> time before all the nodes know about the keyspace.
>
> So, if I do this:
>
>    sm = SystemManager(random.choice(server_list))
>    sm.create_keyspace(keyspace, SIMPLE_STRATEGY, {'replication_factor': 
> '1'})
>    sm.close()
>
> and then immediately pick a different node, it often will raise 
> InvalidRequestException(why="Keyspace 'foo' does not exist")
>
>
> Is there a better way to handle this than just avoiding immediately asking 
> other nodes for the keyspace?
>
>
> John
>