# What&#8217;s new in Apache Cassandra 2.0 (Part 2)

[Blog](/blog/)&gt;[Technology](/blog/category/technical/)&gt;What’s new in Apache Cassandra 2.0 (Part 2) 

What’s new in Apache Cassandra 2.0 (Part 2)
===========================================

August 06, 2013 | By [ Instaclustr ](https://www.instaclustr.com/blog/author/instaclustr/)

 

 

 

 



   [ ](https://x.com/intent/tweet?text=What%E2%80%99s%20new%20in%20Apache%20Cassandra%202.0%20(Part%202)&url=https://www.instaclustr.com/blog/whats-new-in-cassandra-2-0-part-2/) [ ](https://www.linkedin.com/shareArticle?mini=true&url=https://www.instaclustr.com/blog/whats-new-in-cassandra-2-0-part-2/&title=&summary=What%E2%80%99s%20new%20in%20Apache%20Cassandra%202.0%20(Part%202)&source=) 

Following on from our last post, the next big feature in [Apache Cassandra](https://www.instaclustr.com/platform/managed-apache-cassandra/) 2.0 that I will look at are the new type of lightweight transactions called compare and set operations.

Compare and Set (CAS)
---------------------

The next big ticket item in Cassandra 2.0 are compare and set operations (CAS). These operations allow developers to perform updates, inserts and deletes when certain conditions are met in an atomic fashion. Not to be confused with batch operations or multi-statement transactions found in SQL, CAS operations allow you to perform operations like:

`UPDATE test SET v1 = 5, v2 = 'foobar' WHERE k = 0 IF v1 = 3 AND v2 = 'bar';`

which will only update values if, and only if, the conditions in the \*IF\* clause are met.

You can also use the **NOT EXISTS** syntax, which is pretty handy:

`INSERT INTO users (name, email, hashed_password) VALUES ('ben', 'ben@instaclustr.com', 'iamasupersecurehash') IF NOT EXISTS;`

The above statement will only create row for the user named **ben** if it doesn’t already exist (assuming **name** is the row key).

These two examples are pretty basic, but give a good idea of what you can do with the new compare and set operations. They make common tasks, such as creating users, a lot easier!

CAS operations use the [Paxos](https://en.wikipedia.org/wiki/Paxos_(computer_science)) algorithm to ensure a level of consistency. However this consistency guarantee comes with a performance penalty as a single CAS operation requires all replica nodes for the row to have “a bit of a chat” about the operation before it succeeds.

The internal mechanics of CAS operations warrant their own discussion outside the scope of this post. If you are interested have a read of [Paxos Made Simple](https://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf) for the gory details of the Paxos protocol. Additionally, you can also read the [a great description of Paxos in Cassandra](https://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0) by Jonathan Ellis.

If you want to dive in and try the new CAS operations yourself check out the `2.0.0-beta1` branch from the [Cassandra repository on GitHub](https://github.com/apache/cassandra/tree/cassandra-2.0.0-beta1).

---

##### Update:

Cassandra 2.0 [Release Candidate 1](https://cassandra.apache.org/download/) is out!

 

 [ Add Instaclustr as a preferred source on Google ](https://google.com/preferences/source?q=instaclustr.com)



 

 ![mail icon]()#### Get the latest articles for open sourceIn your inbox

 <a class="btn btn-primary btn-popup text-dark" href="">Sign up now</a> 

 

 

 

  ### Related content

 [ Zero Downtime Migration to Instaclustr 

 

 Yes, we can migrate existing Cassandra clusters to Instaclustr without any downtime. Here's what to expect from the process... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/zero-downtime-migration-to-instaclustr/) 

 [ Workflow Comparison: Uber Cadence vs Netflix Conductor 

 

 When choosing what’s right for your company’s opensource workflow needs it is important to know the difference and similarities ... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/workflow-comparison-uber-cadence-vs-netflix-conductor/) 

 [ Will Your Cassandra Database Project Succeed?: The New Stack 

 

 Open source Apache Cassandra® continues to stand out as an enterprise-proven solution for organizations seeking high availability... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/will-your-cassandra-database-project-succeed-the-new-stack/) 

 

  <a class="close-modal" href="">×</a>Sign upto ourNewsletter
-----------------------
