Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres store #178

Open
plunkettscott opened this issue Dec 9, 2023 · 1 comment
Open

Postgres store #178

plunkettscott opened this issue Dec 9, 2023 · 1 comment

Comments

@plunkettscott
Copy link

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?

@bounoable
Copy link
Contributor

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) 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants