tl;dr: 2x CAS Stores in a row for same key, durability polling replication for both, will the first one always succeed?
I recall reading somewhere in the docs that multiple successive writes to a single key won’t cause each one to be persisted to disk. This optimization makes sense, but that kind of behaviour is what’s making me wonder what the roll of CAS in a durability poll is. Note that even though I did just mention persistence, I really am only interested in replication (so if there’s a difference…).
resp = storeWithCas(“keyX”, value); //succeeds
storeWithCas(“keyX”, value); //succeeds
…so if both of those processes are run at the same time (and they retry with exponential backoff should one affect the other), will both of those durability polls succeed?
Going back to the persistence analogy, I know it to be true that whichever value is stored first ‘probably’ won’t be written to disk. So since replication and persistence are handled similarly in Couchbase (“eventual”), does that also mean that the first value set ‘probably’ won’t be replicated (causing the durability poll to fail)???
I would try to test this, but it’s a race condition so eh…