In Couchbase's Observe feature, what is the difference between “persistTo” and “replicateTo”?

StackOverflow https://stackoverflow.com/questions/12521102

  •  03-07-2021
  •  | 
  •  

In the Couchbase API, there are store and delete operations that allow you to specify how many nodes an operation must be successfully persisted to before returning. This is expressed through two method parameters:

My question is: what is the difference between the persistTo and replicateTo parameters. For example passing in PersistTo.MASTER + ReplicateTo.THREE appears to be exactly equivalent to passing in PersistTo.FOUR. Are there actually any behavioral differences between calling these observed APIs in those two different styles?

有帮助吗?

解决方案

PersistTo.MASTER + ReplicateTo.THREE means at minimum the item must be on disk on the master node and at least in memory on three replica nodes. In this case the item might not be persisted on the replicas.

PersistTo.FOUR means that the item must be persisted on the master as well as three replicas.

A good way to think about things is that just because an item is replicated to another node doesn't mean that that item has been persisted to disk.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top