问题描述
我终于在nodejs中为Cassandra编写了重试策略,我有一个用例,只要有一个节点副本可用,我就需要通过修改一致性来允许读写最低水平。
我附上了更新的重试代码(retry.js中的DowngradeRetryPolicy),请您检查链接并发表评论,
/ p>
1)我期望使用此重试策略的问题列表?
2)此代码有什么问题吗?我需要做一些更改来处理极端情况吗?
使用降级一致性重试策略会使您的应用程序一致性保证达到处于最低水平。从理论上讲,第一次使用较低的一致性级别是等效的。
我个人认为这种类型的策略没有太大用处,除非您是处理应用程序的正常模式和降级模式。
关于代码,对我来说不错。
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?
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.
这篇关于使用Node.js重试Cassandra中的策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!