cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Hardouin <romainh...@yahoo.fr>
Subject Re: Lightweight Transactions during datacenter outage
Date Wed, 08 Jun 2016 16:42:39 GMT
> Would you know why the driver doesn't automatically change to LOCAL_SERIAL during a DC
outage ?
I would say because *you* decide, not the driver ;-) This kind of fallback could be achieved
with a custom downgrading policy (DowngradingConsistencyRetryPolicy [*] doesn't handle ConsistencyLevel.SERIAL
/ LOCAL_SERIAL )
* https://github.com/datastax/python-driver/blob/2.7.2-cassandra-2.1/cassandra/policies.py#L747
Best,
Romain
 

    Le Mercredi 8 juin 2016 15h41, Jeronimo de A. Barros <jeronimo.barros@gmail.com>
a écrit :
 

 Tyler,
Thank you, it's working now:
self.query['online'] = SimpleStatement("UPDATE table USING ttl %s SET l = True WHERE k2 =
%s IF l = False;", consistency_level=ConsistencyLevel.LOCAL_QUORUM, serial_consistency_level=ConsistencyLevel.LOCAL_SERIAL) 
Would you know why the driver doesn't automatically change to LOCAL_SERIAL during a DC outage
? Or the driver already has an option to make this change from SERIAL to LOCAL_SERIAL ?
Again, thank you very much, the bill for the beers is on me in September during the Cassandra
Summit. ;-)
Best regards, Jero

On Tue, Jun 7, 2016 at 6:39 PM, Tyler Hobbs <tyler@datastax.com> wrote:

You can set the serial_consistency_level to LOCAL_SERIAL to tolerate a DC failure: http://datastax.github.io/python-driver/api/cassandra/query.html#cassandra.query.Statement.serial_consistency_level. 
It defaults to SERIAL, which ignores DCs.

On Tue, Jun 7, 2016 at 12:26 PM, Jeronimo de A. Barros <jeronimo.barros@gmail.com> wrote:

Hi,
I have a cluster spreaded among 2 datacenters (DC1 and DC2), two server on each DC and I have
a keyspace with NetworkTopologyStrategy (DC1:2 and DC2:2) with the following table:
CREATE TABLE test (  k1 int,  k2 timeuuid,  PRIMARY KEY ((k1), k2)) WITH CLUSTERING ORDER
BY (k2 DESC)
During a datacenter outage, as soon as a datacenter goes offline, I get this error during
a lightweight transaction:
cqlsh:devtest> insert into test (k1,k2) values(1,now()) if not exists;Request did not complete
within rpc_timeout.                                          
And a short time after the on-line DC verify the second DC is off-line:
cqlsh:devtest> insert into test (k1,k2) values(1,now()) if not exists;Unable to complete
request: one or more nodes were unavailable.                       
So, my question is: Is there any way to keep lightweight transactions working during a datacenter
outage using the C* Python driver 2.7.2 ?
I was thinking about catch the exception and do a simple insert (without "IF") when the error
occur, but having the lightweight transactions working even during a DC outage/split would
be nice.
Thanks in advance for any help/hints.
Best regards, Jero



-- 
Tyler Hobbs
DataStax




  
Mime
View raw message