Enforcing data replications and/or persistence on writes

Hi,

Is there any way to enforce that writes are replicated and/or written to disk before returning? I realise that there is a performance tradeoff, but I have a few use cases - in particular with financial transactions - where I would want to guarantee durability.

If there’s no way to guarantee persistence / replication before returning, is there a way to check the state of replications / persistence of a particular write through a stats API?

Thanks.

Yes, when using the SDK there are optional parameters that specify PersistTo and ReplicateTo.
These will only return when the document has been replicated and/or persisted to the specified number of nodes.

https://developer.couchbase.com/documentation/server/4.0/sdks/dotnet-2.2/persistto.html

If you’re using another SDK just check how to set those.

1 Like

Great, thanks. I’ll not be using one of the SDKs, but I’ll use the code as a reference to work out how to achieve the same result.