How do atomic batches work in Cassandra?

前端 未结 3 1648
忘掉有多难
忘掉有多难 2020-12-09 03:54

How can atomic batches guarantee that either all statements in a single batch will be executed or none?

3条回答
  •  青春惊慌失措
    2020-12-09 04:42

    Batch documentation (doc) :

    In Cassandra 1.2 and later, batches are atomic by default. In the context of a Cassandra batch operation, atomic means that if any of the batch succeeds, all of it will. To achieve atomicity, Cassandra first writes the serialized batch to the batchlog system table that consumes the serialized batch as blob data. When the rows in the batch have been successfully written and persisted (or hinted) the batchlog data is removed. There is a performance penalty for atomicity. If you do not want to incur this penalty, prevent Cassandra from writing to the batchlog system by using the UNLOGGED option: BEGIN UNLOGGED BATCH

提交回复
热议问题