Skip to content

UPSERT slot can be incorect? #48

@xoac

Description

@xoac

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?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions