简体   繁体   中英

How to set the downgrading policy in Cassandra using nodejs

I am not sure about setting the policy 'DowngradingRetryPolicy' in nodejs using Cassandra.

policies : { loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy,
                                                   retry: new cassandra.policies.retry.IdempotenceAwareRetryPolicy(new cassandra.policies.retry.RetryPolicy())
                                                 } });

This is how I set the IdempotenceAwareRetryPolicy policy and it is working as expected but How to set the ' DowngradingRetryPolicy ' policy in Cassandra using nodejs

For reference adding the ruby implementation,

https://datastax.github.io/ruby-driver/features/retry_policies/downgrading_consistency/

There is no downgrading consistency retry policy in nodejs. This is a good thing imho, it doesn't make much sense in context of C* consistency guarantees. People can always write own retry policy to do it if really need it, but to be there by default encourages a dangerous setup that can violate consistency expectations at unexpected/random times.

However, if you are thinking about a using downgrading retry policy, just use CL.ONE and a normal policy. You would have to assume that all queries will execute at that anyway or your application would not be safe. So might as well get the performance improvements of the reduced consistency level.

Unless theres a strong reason for it, you will be best served just sticking with the default TokenAwarePolicy wrapping DCAwareRoundRobinPolicy. Just DCAwareRoundRobinPolicy probably best for stability.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM