【问题标题】:How exactly batch work in cql批处理在 cql 中究竟是如何工作的
【发布时间】:2015-08-29 19:33:49
【问题描述】:

我正在浏览 datastax CQL Java Driver 2.1 驱动程序文档以及 CQL 2.X 参考 pdf:

在 CQL 参考 pdf 中:

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. 

在CQL java驱动pdf中:

Batch operations
The BATCH statement combines multiple data modification statements (INSERT, UPDATE, DELETE) into
a single logical operation which is sent to the server in a single request. Also batching together multiple
operations ensures these are executed in an atomic way: either all succeed or none.

所以我从一开始就明白,即使批处理中的单个查询成功,批处理也是成功的。

从一开始我就明白,即使批处理中的单个查询失败,批处理也会失败

那么具体是什么?

【问题讨论】:

  • 如果我在一个 BATCH 内的不同表上执行两个 INSERT,那真的是一个 BATCH 执行吗?
  • 用 Cassandra 的话来说,是的。两个插入将在一批中一起执行。
  • 你能提供这两个的链接吗?

标签: cassandra cassandra-2.0 datastax cql3 datastax-java-driver


【解决方案1】:

记录批次的目的是原子性。如果批处理中的任何一个查询失败,则整个批处理将失败,如果批处理成功,则意味着批处理中的每个查询都成功。

either all succeed or none 是准确的。

【讨论】:

  • 所以如果我在一个批次中对two different table 使用插入、删除或更新,那么它也会这样吗?
猜你喜欢
  • 2021-06-18
  • 2023-04-01
  • 2011-06-26
  • 2021-08-15
  • 2012-06-08
  • 2011-10-11
  • 2013-07-05
  • 1970-01-01
相关资源
最近更新 更多