[internal] Idempotency checks in IndexWriter


This isn’t a bug I had but more about a piece of code I find not following what is documented on the Docs.

Here’s the use case. Let’s say we want to perform a Write and gave an Any or StreamExists version.

If the Docs is right, we should only make sure that the Write request’s events shouldn’t be partially committed,

meaning some are committed while others aren’t. In such case, the write request must fail.

However the code in IndexWriter doesn’t seem to apply this rule particularly when we look at this IndexWriter.cs line.

For instance, if the write request is comprised of 2 events, it will not bother to check if the 2nd event was committed already if the 1st one isn’t committed yet.

This should be detected as a *CorruptedIdempotency *but will pass according to current implementation.

Did I get this code wrong ?

Thanks for your time.


Any thought on this ?

Will look when I get a few.

These are odd edge conditions in general. I have been thinking a lot
about these use case and am starting to become of the opinion that

B,C, D

should be idempotent for B,C eg to look at the event level not the
request level as it currently does. Likely less confusing for people

So if I got you right, we shouldn’t have any CorruptedIdempotency when submitting Any|StreamExists expected version
with your idea ? The server will just does its best to not introduce duplicates and that’s it ?

Personally, I don’t mind. I just want to make sure I understood what you said.

So I am saying: Given what I know today I would likely not have
implemented any of this in this way. I would make idempotency on a per
event basis not on a per request