You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "B. Todd Burruss" <bb...@real.com> on 2010/10/12 02:53:17 UTC

getSchemaVersion

  to determine if my programmatic schema changes have been distributed 
throughout the cluster, I am supposed to use getSchemaVersionMap, correct?

my question is how do I properly use it?  I have the schema version 
returned from the thrift method, and I can lookup in the schema map 
returned getSchemaVersionMap, but i'm not sure the proper way to 
interpret results.

do i wait until getSchemaVersionMap has an entry for the version in 
question that contains all the nodes in my cluster?

if this is the case, then i'm having trouble getting the number of nodes 
if i have never created a keyspace.  with no keyspace i can't ask for 
the ring, in which case i can't count the number of nodes.

is there a better way to do this?

Re: getSchemaVersion

Posted by Jonathan Ellis <jb...@gmail.com>.
On Mon, Oct 11, 2010 at 9:48 PM, B. Todd Burruss <bb...@real.com> wrote:
> i was actually doing this to start with and was worried that i could have
> two clients modifying schemas at the same time.  it seems this could cause
> multiple valid versions and a race condition.  maybe it simply "works out"
> that i wait until only one version is in the map, *if* get the version map
> from the same host that i used to modify the schema?

I don't think you need to worry about that specific scenario but the
whole schema change code is designed with the precondition that you
are only making changes from one node at a time.  If you can't make
that assumption then you need to lock.

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Re: getSchemaVersion

Posted by "B. Todd Burruss" <bb...@real.com>.
On 10/11/2010 06:14 PM, Jonathan Ellis wrote:
> On Mon, Oct 11, 2010 at 7:53 PM, B. Todd Burruss<bb...@real.com>  wrote:
>>   to determine if my programmatic schema changes have been distributed
>> throughout the cluster, I am supposed to use getSchemaVersionMap, correct?
>>
>> my question is how do I properly use it?  I have the schema version returned
>> from the thrift method, and I can lookup in the schema map returned
>> getSchemaVersionMap, but i'm not sure the proper way to interpret results.
>>
>> do i wait until getSchemaVersionMap has an entry for the version in question
>> that contains all the nodes in my cluster?
> Yes.
>
>> if this is the case, then i'm having trouble getting the number of nodes if
>> i have never created a keyspace.  with no keyspace i can't ask for the ring,
>> in which case i can't count the number of nodes.
> Each node can only have one active version, so the converse of "my new
> version has all the nodes in the cluster" is "there are no other
> versions present in the map."
>
i was actually doing this to start with and was worried that i could 
have two clients modifying schemas at the same time.  it seems this 
could cause multiple valid versions and a race condition.  maybe it 
simply "works out" that i wait until only one version is in the map, 
*if* get the version map from the same host that i used to modify the 
schema?

does this make sense?


Re: getSchemaVersion

Posted by Jonathan Ellis <jb...@gmail.com>.
On Mon, Oct 11, 2010 at 7:53 PM, B. Todd Burruss <bb...@real.com> wrote:
>  to determine if my programmatic schema changes have been distributed
> throughout the cluster, I am supposed to use getSchemaVersionMap, correct?
>
> my question is how do I properly use it?  I have the schema version returned
> from the thrift method, and I can lookup in the schema map returned
> getSchemaVersionMap, but i'm not sure the proper way to interpret results.
>
> do i wait until getSchemaVersionMap has an entry for the version in question
> that contains all the nodes in my cluster?

Yes.

> if this is the case, then i'm having trouble getting the number of nodes if
> i have never created a keyspace.  with no keyspace i can't ask for the ring,
> in which case i can't count the number of nodes.

Each node can only have one active version, so the converse of "my new
version has all the nodes in the cluster" is "there are no other
versions present in the map."

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com