4

How might you force a Cassandra error that triggers a retry policy?

According to the DataStax, the following errors trigger a retry policy:

  • Read and write timeouts.
  • When the coordinator determines there are not enough replicas to satisfy a request.

Edit: The driver I'm using is called gocql

Tantillo
  • 367
  • 1
  • 5

1 Answers1

2

Toggle the network connection of a node off, and it will appear momentarily down. Any request that needed that node to satisfy the consistency level, or if that node was the co-ordinator of the query will need to retry.

Andrew
  • 26,629
  • 5
  • 63
  • 86
  • Note that the retry policy will only kick in for idempotent queries. This can be configured in the Java driver on Statements. https://docs.datastax.com/en/developer/java-driver/latest/manual/core/idempotence/ – csplinter Jul 21 '20 at 13:22
  • In this instance, the OP is using the gocql driver, although that is only known from another question - but you are correct also for that driver, it does check idempotence. – Andrew Jul 21 '20 at 13:28
  • Andrew, for a single node cluster running in a Docker container, would a simple restart of the container produce the affect you describe? I tagged gocql in this question, but did not specify it as the driver I'm using. Thanks for the heads up. – Tantillo Jul 22 '20 at 19:34
  • It should cause a retry, assuming the statement is considered idempotent. – Andrew Jul 23 '20 at 07:58