cassandra java driver 3.6版本,当请求发生OverloadedException异常时,发现有重试机制。未显示配置重试策略。
对于默认重试策略,java driver的重试机制和重试次数分别是什么?其他语言的driver(python, go等)的重试机制和java的相同吗?不同的话重试次数和机制分别是什么
cassandra java driver 3.6版本,当请求发生OverloadedException异常时,发现有重试机制。未显示配置重试策略。
对于默认重试策略,java driver的重试机制和重试次数分别是什么?其他语言的driver(python, go等)的重试机制和java的相同吗?不同的话重试次数和机制分别是什么
When the driver runs a query, the configured load balancing policy computes a query plan (a list of nodes to connect to). The driver tries each of the hosts in the query plan based on the retry policy.
If a coordinator can't be reached or returns an error, the driver will either:
In the case where the coordinator returns an OverloadedException
, the DefaultRetryPolicy will retry the request on the next node in the query plan.
The number of retries isn't fixed since it depends on the outcome of each attempt.
In general, the retry mechanism is the same for DataStax drivers but I can't comment on other drivers such as GoCQL since it is not maintained by DataStax.
For more details, see the Java driver 3.6 Retry Policy. Cheers!
thank you for you apply.
In the case where the coordinator returns an OverloadedException
, the DefaultRetryPolicy will retry the request on the next node in the query plan.
他会在其他节点继续重试执行查询,如果每个节点都抛`OverloadedException
`,假如都是单副本集群,对于3节点集群,会重试3次?对于5节点集群,那么重试5次?以此类推?或者是不是有个重试上限,比如最多重试几次或者driver自己是否有查询请求的超时时间?
The driver will try to connect to the nodes in the query plan. It will not always retry the request unless the RetryPolicy.RetryDecision
determines that the next action is to retry. You can't assume that the driver will repeatedly try the next host until it runs out of nodes to try.
For example, if the coordinator node returns a READ_TIMEOUT
error to the driver and the query has not been retried before, the DefaultRetryPolicy
will retry again on the same node. But if the query has already been retried once, the driver will throw a ReadTimeoutException
to the application.
Specifically for the DefaultRetryPolicy
, it will only retry once. You can see the details of the RetryDecision
for the DefaultRetryPolicy
here. Cheers!
6 People are following this question.
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2023 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use