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

UPSERT slot can be incorect? #48

Open
xoac opened this issue Oct 14, 2022 · 0 comments
Open

UPSERT slot can be incorect? #48

xoac opened this issue Oct 14, 2022 · 0 comments
Assignees

Comments

@xoac
Copy link
Contributor

xoac commented Oct 14, 2022

I think that with concurrent writes to DB there is a small chance that insert into slot table will create invalid data.

Scenario:
function update_slot from RPC produce 3 updates per slot processed, confirmed and rooted in that order

Now we have concurrent writes to DB:
if we write them in order root, confirmed, processed then we have incorrect data in DB

INSERT INTO slot (slot, parent, status, updated_on) \
        VALUES ($1, $2, $3, $4) \
        ON CONFLICT (slot) DO UPDATE SET parent=excluded.parent, status=excluded.status, updated_on=excluded.updated_on

Am I correct?

@lijunwangs lijunwangs self-assigned this May 30, 2023
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