Retry policies in Cassandra using nodejs

孤者浪人 提交于 2019-12-02 05:13:57

问题


I finally have written a retry policy for Cassandra in nodejs, I have a use case where the whenever there is a one node replica available I need to allow the read and write by modifying my consistency to the minimum level.

I have attached my updated retry code (DowngradeRetryPolicy in retry.js), Could you please check the link and give your comments,

https://gist.github.com/harigist/f74b29976702a84f8f37e1bf7b509e0e

1) I expect the list of problems in using this retry policy?
2) Anything wrong with this code? Is there a change I need to make to handle corner cases?


回答1:


Using a downgrading consistency retry policy causes your application consistency guarantee to be at minimum level. It would be theoretically equivalent to use a lower consistency level the first time.

I personally don't see much use for that type of policy except in the cases when you are handling a "normal mode" and "degraded mode" of your application.

About the code, it looks good to me.




回答2:


Question... as per the docs the policy interface consists of four methods:

onReadTimeout, onUnavailable, onWriteTimeout, and onRequestError

in your policy, i only see 3. If any are omitted, what happens? Is the default logic used?

Also, another thing I see you're not using in your code is a _childPolicy https://github.com/datastax/nodejs-driver/blob/master/lib/policies/retry.js#L160



来源:https://stackoverflow.com/questions/48202044/retry-policies-in-cassandra-using-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!