Skip to content

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.

I have gone through: how do I find out if the update query was successful or not in Cassandra Datastax

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?



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.

User contributions licensed under: CC BY-SA
8 People found this is helpful