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

Inconsistency in database writes #153

Open
mabdh opened this issue Aug 13, 2022 · 3 comments
Open

Inconsistency in database writes #153

mabdh opened this issue Aug 13, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@mabdh
Copy link
Member

mabdh commented Aug 13, 2022

Is your feature request related to a problem? Please describe.
There are some places where we add a new organization, group, and project. For those cases, we auto create the creator of those as the member and admin. With this flow, we are writing to 2 places, postgres and spicedb.

However there is a case where we are successfully creating a record in postgres but failed to write to spicedb. This case will make inconsistency in our system. User won't be able to check the authorization even though he is the one who created the org/group/project.

Describe the solution you'd like
The cases above could be solved by considering the writing to 2 places, postgres and spicedb as an atomic transaction. We can wrap both action with a PostgresDB transaction with one of two solutions mentioned in this discussion.

@mabdh mabdh added the bug Something isn't working label Aug 13, 2022
@mabdh mabdh changed the title bug: inconsistencies when writing to 2 datastore bug: inconsistencies when writing to 2 datastores Aug 13, 2022
@krtkvrm
Copy link
Member

krtkvrm commented Aug 15, 2022

We are still thinking about consistency issue when writing to different DBs. I am bit more inclined towards fire-and-forget, where we use something like outbox pattern to only use 1 call

@mabdh
Copy link
Member Author

mabdh commented Aug 16, 2022

@krtkvrm is there any specific reason you prefer that approach? wouldn't that approach be more complex with shield use case?

@ravisuhag ravisuhag moved this to 2024 in Roadmap Apr 10, 2024
@ravisuhag
Copy link
Member

@kushsharma @anujk14 Is this issue applicable?

@ravisuhag ravisuhag changed the title bug: inconsistencies when writing to 2 datastores Inconsistency in databases Jun 20, 2024
@ravisuhag ravisuhag changed the title Inconsistency in databases Inconsistency in database writes Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 2024
Development

No branches or pull requests

3 participants