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.bar...@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 <http://datastax.com/>