OK.. so if I’m running with 2 replicas, then BOTH of them need to be online for this to work. Correct? Because with two replicas I need 2 to form a quorum.
This is somewhat confusing them. Because if you have two replicas, and you’re depending on these types of transactions, then this is a VERY dangerous state. Because if ANY of your Cassandra nodes goes offline, then your entire application crashes. So the more nodes you have, the HIGHER the probability that your application will crash. Which is just what happened to me. And in retrospect, this makes total sense, but of course I just missed this in the application design. So ConsistencyLevel.ONE and if not exists are essentially mutually incompatible and shouldn’t the driver throw an exception if the user requests this configuration? Its dangerous enough that it probably shouldn’t be supported. On Sun, Jan 18, 2015 at 7:43 AM, Eric Stevens <migh...@gmail.com> wrote: > Check out > http://www.datastax.com/documentation/cassandra/2.0/cassandra/dml/dml_tunable_consistency_c.html > > > Cassandra 2.0 uses the Paxos consensus protocol, which resembles > 2-phase commit, to support linearizable consistency. All operations are > quorum-based ... > > This kicks in whenever you do CAS operations (eg, IF NOT EXISTS). > Otherwise a cluster which became network partitioned would end up being > able to have two separate CAS statements which both succeeded, but which > disagreed with each other. > > On Sun, Jan 18, 2015 at 8:02 AM, Kevin Burton <bur...@spinn3r.com> wrote: > >> I’m really confused here. >> >> I”m calling: >> >> acquireInsert.setConsistencyLevel( ConsistencyLevel.ONE ); >> >> but I”m still getting the exception: >> >> com.datastax.driver.core.exceptions.UnavailableException: Not enough >> replica available for query at consistency SERIAL (2 required but only 1 >> alive) >> >> Does it matter that I’m using: >> >> ifNotExists(); >> >> and that maybe cassandra needs two because it’s using a coordinator ? >> >> If so then an exception should probably be thrown when I try to set a >> wrong consistency level. >> >> which would be weird because I *do* have at least two replicas online. I >> have 4 nodes in my cluster right now... >> >> -- >> >> Founder/CEO Spinn3r.com >> Location: *San Francisco, CA* >> blog: http://burtonator.wordpress.com >> … or check out my Google+ profile >> <https://plus.google.com/102718274791889610666/posts> >> <http://spinn3r.com> >> >> > -- Founder/CEO Spinn3r.com Location: *San Francisco, CA* blog: http://burtonator.wordpress.com … or check out my Google+ profile <https://plus.google.com/102718274791889610666/posts> <http://spinn3r.com>