Durability Questions

What is the difference between none, majority, majority And PersistActive, and persistToMajority?

I checked "Durability | Couchbase Docs " but I don’t understand well.

Doesn’t any setting write to memory and disk?

Is there an example?

A write has to be in memory before it can reach disk, so any setting that requires persistence (i.e. writing to disk) implies it has been received on the nodes in memory before being written to disk.

In all cases the nodes in question are the nodes hosting the vBucket (active and replicas).

  • “majority” is memory only - make sure a majority of the vBucket-nodes have the data in memory (at least).
  • “majorityAndPersistActive” is the above plus written to disk on the node hosting the active copy of the data.
  • “persistToMajority” is the above plus written to disk on the majority of vBucket-nodes.

(Note the restrictions on bucket types etc. in the documentation.)

In terms of example, it depends on how you want to set it. If set for a bucket it is via the bucket properties. (https://docs.couchbase.com/server/current/rest-api/rest-bucket-create.html#example-durabilityminlevel-create)

Different clients will have different methods for setting it, though it seems the SDK docs don’t include an example yet.

The Query service supports the “durability_level” request parameter. The worked example for transactions does include examples of setting it.


What does no durability level mean?

Does setting “Majority And PersistActive” and “PersistToMajority” mean the reset value will remain at 100%?

I want to know the meaning, not the setting method.

Doesn’t the data go up in the memory no matter what the setting is?

“None” was an omission (sorry); this is regular writing and is simply that the mutation was received and processed by the appropriate node - this may be in memory only - before an acknowledgement is sent. It does not require it to have been flushed to disk nor for other nodes to hold copies of it before it is acknowledged. Docs.

What do you mean by “the reset value will remain at 100%” ? Durability only affects write resilience to unexpected events. (The stricter the setting the less likely a write will be lost should the cluster be affected by an unexpected anomaly.)

Sorry, I tried to address your explicit question “Doesn’t any setting write to memory and disk?” in the preamble. Clearly this missed your point, similarly for the “Is there an example?” question I tried to address with what I believed was what you were after - I provided the examples of setting it since I can’t see what other example you could want further to the explanations given.

Perhaps you could expand on what you want to see in a response here?

I see you explicitly asked for differences, so here’s an attempt (though it is really just a repeat):

  • None - base line; regular writes with no durability requirements. Mutations are acknowledged without (necessarily) copies existing on other vBucket-nodes nor having been written to disk anywhere.
  • majority - adds the requirement that the majority of vBucket-nodes have the mutation in memory before the acknowledgement is sent.
  • majorityAndPersistActive - same as “majority” plus it adds the need for the active vBucket node to have flushed to disk.
  • persistToMajority - adds the need for the majority of vBucket-nodes to have flushed the mutation to disk before acknowledging.

“I want to know the meaning, not the setting method.” I’m sorry but I don’t understand this. The term “durability” is explained in the first sentence of the documentation and the levels are explained thereafter with attempted further clarification here. But this can’t be what you’re after… What is the “meaning” you’re after if not what “durability” is nor how each level setting changes mutation processing?

“Doesn’t the data go up in the memory no matter what the setting is?” I’m reading this to mean “is it received and processed in memory”; if correct then, yes - as noted at the start of my response. (Which was specifically included to address the “write to memory” portion of your request; again I’m sorry if this has confused things.)

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.