sql-event-store icon indicating copy to clipboard operation
sql-event-store copied to clipboard

Update PostgreSQL to use the sequence number to check previous events…

Open fasar opened this issue 2 years ago • 2 comments

Dear mattnitshop,

I update the postgresql ddl to use the sequence as the lock for the previous event in the stream. I also update the unit test.

  • What do you think ?
  • Did you think I miss something ?
  • Using UUID is mandatory ?

If you are agree with that, I will try to update the sqlite. Thank you for you reply.

Best regards, Fabien.

fasar avatar Jan 25 '23 08:01 fasar

First of all, thank you for the Postgres docker contribution! Would you be able to produce a new PR with just those changes? I would like to merge that in.

mattbishop avatar Jan 25 '23 15:01 mattbishop

I realized that I left out an important goal of this project, which was to make appending events require replaying events to be certain the new event is appended with an up-to-date model of the ledger state. What I have found with sequence IDs is that developers will write client code that skips the step of replaying events on a race condition. Instead, they manually increment the sequence ID to "find" the latest event rather than replaying.

This is important to ensure the events in the ledger match the business rules managed by the command handlers. It builds trust in the ledger to know the appended events are truly sequential without technical loopholes that the sequentially-incrementing field would expose.

Please let me know if this makes sense.

mattbishop avatar Jan 25 '23 15:01 mattbishop