modernice/goes

Postgres store

Opened this issue · 1 comments

I see the Postgres store is still under active development and is missing the “Aggregate version consistency validation” feature. Is there a reason this feature isn’t implemented (difficulty, time, etc.)?

I’m interested in using goes but don’t want to bring a new technology to the stack (MongoDB). I’d be willing to help contribute to the Postgres store if you’re willing to help me understand what is missing exactly.

Can you maybe point me to the feature in the Mongo store that’s missing in Postgres? Are you on Slack or Discord where we could potentially chat about this?

Theoretically, the Postgres store should be usable as it passes all the tests. I just hadn't had the time yet to test the Postgres store with a production setup because we have been using MongoDB for all our event stores until now.

I didn't implement the "aggregate version consistency" check yet because I wasn't sure what would be the best way to do this. In the MongoDB store I used a separate collection that contains the current version of each aggregate to determine if an "event insertion" is valid: https://github.com/modernice/goes/blob/main/backend/mongo/store.go#L497

So for example, if the latest event of an aggregate in the event store is at version 10, then the next inserted event must be at version 11. This checks ensures that concurrent insertions by multiple services/processes don't cause aggregate consistency issues.

For the Postgres store, I'm pretty sure there is a way to do this with an "auto-increment" index but I haven't tried this out yet.

If you have any questions, you can DM me on Discord (same username) 👍🏼