Comment by luuio

Comment by luuio 2 days ago

4 replies

> why wouldn't doing the same write twice produce an idempotent result

you can imagine this:

```

var thing = KVStore.Get<MyThing>(...);

if (things.Checkpoints.Contains(myUuid) == false) {

  thing.Counter += 1;
}

KVStore.Update(thing); ```

having an etag doesn't help you with retries, where we expect that `thing` could be mutated by another flow between your retries.

jrochkind1 a day ago

If the thing was mutated between your retries, then wasn't the etag changed by that mutation? So if you know the etag you started with, your conditional update on etag fails due to changed etag. So you fetch it again and start over. Which is the general optimistic locking algorithm.

i may be missing something though?

  • luuio 10 hours ago

    let's say you have an object like this when you started: {count: 10, etag: 1}. then for some reason, something failed.

    when you retry and load the object, you get {count: 12, etag: 3}. how do you know if your previous attempt had successfully persisted or not, or if the updates to the object came from other processes/requests?

    you're mixing up conflict handling vs. idempotency

    • jrochkind1 8 hours ago

      Ah, the system is not capable of giving you a confirmation that your update succeeded, you don't really have a way to know without external "checkpoint" system?

      Anyway, okay, I get that I don't get it, and I get that it does sound terrible, agreed!

    • [removed] 8 hours ago
      [deleted]