couchdbcloudant

Can we avoid eventual consistency in Cloudant with quorum in the query?


I have a requirement where I need to read the documents immediately after writing to the Cloudant DB. Sometimes the DB returns inconsistent results which is expected. But can we avoid eventual consistency by setting the quorum parameter to a higher value (> 2) in the query?

{
  "selector": {
     "year": {
         "$gt": 2010
     }
  },
  "r": 5
}

Solution

  • No.

    There is no way to "remove" eventual consistency in Cloudant (safely). None. My advice would be to not mess with quorum and replicas other than the default values which are set as they are for very good reasons.

    If you find yourself needing to work around eventual consistency, either your workload or your data model is unsuited for Cloudant.

    Here's a good intro (disclaimer: I'm the author) https://blog.cloudant.com/2019/11/21/Best-and-Worst-Practices.html