Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra - transaction support

I am going through apache cassandra and working on sample data insertion, retrieving etc.

The documentation is very limited.

I am interested in knowing

  • can we completely replace relation db like mysql/ oracle with cassandra?
  • does cassandra support rollback/ commit?
  • does cassandra clients (thrift/ hector) support fetching associated object (objects where we save one super columns' key in another super column family)?

This will help me a lot to proceed further.

thank you in advance.

like image 793
Kumar D Avatar asked Jun 04 '10 18:06

Kumar D


People also ask

Does Cassandra support transaction?

Cassandra does not use RDBMS ACID transactions with rollback or locking mechanisms, but instead offers atomic, isolated, and durable transactions with eventual/tunable consistency that lets the user decide how strong or eventual they want each transaction's consistency to be.

What does Cassandra not support?

Cassandra has limitations when it comes to: ACID transactions. If you expect Cassandra to build a system supporting ACID properties (Atomicity, Consistency, Isolation and Durability), unfortunately, it won't work.

Is Cassandra ACID compliant?

Cassandra, ACID and BASE While it does support other ACID-like features, such as strong consistency (using CL=ALL), compare-and-set updates with Lightweight Transactions, atomicity and isolation on the row-level, and has a durable writes option, it is inaccurate to describe Cassandra as an ACID-compliant database.

Does Netflix still use Cassandra?

Cassandra, with its distributed architecture, was a natural choice, and by 2013, most of Netflix's data was housed there, and Netflix still uses Cassandra today.


1 Answers

Short answer: No.

By design, Cassandra values availability and partition tolerance over consistency1. Basically, it's not possible to get acceptable latency while maintaining all three of qualities: one has to be sacrificed. This is called CAP theorem.

The amount of consistency is configurable in Cassandra using consistency levels, but there doesn't exist any semantics for rollback. There's no guarantee that you'll be able to roll back your changes even if the first write succeeds.

If you want to build application with transactions or locks on top of Cassandra, you probably want to look at Zookeeper, which can be used to provide distributed synchronization.

You might've already guessed this, but Cassandra doesn't have foreign keys or anything like that. This has to be handled manually. I'm not that familiar with Hector, but a higher-level client could be able to do this semi-automatically.

Whether or not you can use Cassandra to easily replace a RDBMS depends on your specific use case. In your use case (based on your questions), it might be hard to do so.

like image 117
Lautis Avatar answered Oct 04 '22 11:10

Lautis