incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Everton Lima <peitin.inu...@gmail.com>
Subject Re: SchemaDisagreementException
Date Fri, 16 Nov 2012 14:09:05 GMT
I do that because I need to create a dynamic column families.
I create 2 keyspaces in  the start of application, using embedded cassandra
instance too, but it's never throw exception. And than, insert dynamic
column families in this 2 keyspaces.

I put a "Thread.sleep(3000);" in the middle of the creation column family
code.

            int watiTime = 3000;
            logger.info("Waiting "+(watiTime/1000)+"s for synchronizing
...");
            Thread.sleep(watiTime);
            CassandraHelper.createColumnFamily(CassandraHelper.KEYSPACE,
layer);
            logger.info("Waiting "+(watiTime/1000)+"s for synchronizing
...");
            Thread.sleep(watiTime);

I do that, because in the code of CassandraStress, after create a column
family, it do that too. It is wrong or good solution?
Any other idea?



2012/11/14 aaron morton <aaron@thelastpickle.com>

> Out of interest why are you creating column families by making direct
> calls on an embedded cassandra instance ? I would guess you life would be
> easier if you defined a schema in CQL or CLI.
>
>
> I already read in the documentation that this error occurs when more than
> one thread/processor access the same place in the Cassandra, but I think
> this is not occuring.
>
> How may nodes do you have ?
>
I am using 3 nodes.

> What version are you running ?
>
The version is 1.1.6

> It sounds like you have run simultaneous schema updates and the global
> schema has diverged.
>
> If you can create your schema in CLI or CQL I would recommend doing that.
> If you are trying to do something more complicated you'll need to provide
> more information.
>
> Cheers
>
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 15/11/2012, at 3:13 AM, Everton Lima <peitin.inutil@gmail.com> wrote:
>
> Some times, when I try to insert a data in Cassandra with Method:
>
> static void createColumnFamily(String keySpace, String columnFamily){
>  synchronized (mutex){
>   Iface cs = new CassandraServer();
>   CfDef cfDef = new CfDef(keySpace, columnFamily);
>
>   cfDef = cfDef.setComparator_type(comparator.toString());
>   cfDef = cfDef.setKey_validation_class(UTF8Type.class.getName());
>   cfDef = cfDef.setCaching("all");
>
>   cs.set_keyspace(keySpace);
>   cs.system_add_column_family(cfDef);
>  }
> }
>
> I run this method in only on process of the distributor system. But in
> this process, I run the method two times consecutive in the same thread,
> but with keyspace diferent.
> I already read in the documentation that this error occurs when more than
> one thread/processor access the same place in the Cassandra, but I think
> this is not occuring.
> Some one cold help me to understand this problem?
>
> Thanks.
>
> --
>
> Everton Lima Aleixo
> Bacharel em Ciencia da Computação
> Universidade Federal de Goiás
>
>
>


-- 

Everton Lima Aleixo
Bacharel em Ciencia da Computação
Universidade Federal de Goiás

Mime
View raw message