Are batch mutations atomic in Cassandra?
The Cassandra API supports batch mutations:
batch_mutate(keyspace, mutation_map, consistency_level): Executes the specified mutations on the keyspace. mutation_map is a map>>; the outer map maps the key to the inner map, which maps the column family to the Mutation; can be read as: map>>. To be more specific, the out开发者_如何学Cer map key is a row key, the inner map key is the column family name. A Mutation specifies either columns to insert or columns to delete. See Mutation and Deletion above for more details.
Are all mutations that are executed in a batch executed atomically? So if one of the mutations fails, do the others fail too?
Everything associated w/ a given key is atomic (which is why batch_mutate allows multiple CFs w/ a single key).
All mutations for a given key are atomic but there is no isolation on reads. Besides that there are no more guarantees.
Cassandra 1.2-beta1 added support for atomic batch update, here too...
- Atomic batches are now supported server side, where Cassandra will guarantee that (at the price of pre-writing the batch to another node first), all mutations in the batch will be applied, even if the coordinator fails mid-batch.
精彩评论