文档在NoHostAvailableException之后仍然创建

huangapple go评论84阅读模式
英文:

Document created even after NoHostAvailableException

问题

I am trying to execute multiple BatchSatements in parallel with ExecutorService of Java. I want to know whether my query is successfully executed.

我正在尝试使用Java的ExecutorService并行执行多个BatchSatements。我想知道我的查询是否成功执行。

I have gone through:
https://stackoverflow.com/questions/52388303/how-do-i-find-out-if-the-update-query-was-successful-or-not-in-cassandra-datasta

我已经阅读了以下内容:
https://stackoverflow.com/questions/52388303/how-do-i-find-out-if-the-update-query-was-successful-or-not-in-cassandra-datasta

It's saying if no exception is there, we can consider it successful. But I am getting NoHostAvailableException.

它说如果没有异常,我们可以认为它成功了。但我收到了NoHostAvailableException。

All host(s) tried for query failed (tried: ***(com.datastax.driver.core.exceptions.OperationTimedOutException: [] Timed out waiting for server response))

所有尝试查询的主机都失败了(尝试:***(com.datastax.driver.core.exceptions.OperationTimedOutException: []超时等待服务器响应))

But I can see my data in Cassandra. I want to know how can I know if my document is created successfully in Cassandra. Is there any way for it?

但我可以在Cassandra中看到我的数据。我想知道如何确定我的文档是否在Cassandra中成功创建。有没有什么方法可以做到这一点?

英文:

I am trying to execute multiple BatchSatements in parallel with ExecutorService of Java. I want to know whether my query is successfully executed.

I have gone through:
https://stackoverflow.com/questions/52388303/how-do-i-find-out-if-the-update-query-was-successful-or-not-in-cassandra-datasta

It's saying if no exception is there, we can consider it successful. But I am getting NoHostAvailableException.

All host(s) tried for query failed (tried: *********************(com.datastax.driver.core.exceptions.OperationTimedOutException: [******************] Timed out waiting for server response))

But I can see my data in Cassandra. I want to know how can I know if my document is created successfully in Cassandra. Is there any way for it?

答案1

得分: 2

Cassandra中的批处理与关系型数据库不同。它们只应在有限数量的用例中使用,不应用于多个分区的插入/更新批处理,除非确实有必要(请参阅“批处理的误用”文档)。

即使在驱动程序返回错误后,批处理也最终会被重播 - 这是因为批处理在执行之前已被复制到其他节点。有关详细信息,请参阅以下图表

英文:

Batches are different in Cassandra in comparison to the relational databases. And they should be used only in limited number of the use cases, and they shouldn't be used for batching of inserts/updates to multiple partions, until it's really necessary (see "misuse of batches" doc).

Batch will be eventually replayed, even if you got an error back to the driver - this happens because batch is replicated to other nodes before execution. See following diagram for details.

huangapple
  • 本文由 发表于 2020年8月12日 18:20:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63374509.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定