Skip to content

Avoid lock upgrades in DeploymentStore.transact_block_operations #2403

@lutter

Description

@lutter

Right now, DeploymentStore.transact_block_operations queries information about the block pointer from subgraph_deployment in the same transaction in which it later updates the same row. That causes a lock upgrade. The lock upgrade is fine in normal operations, since there is only one writer per subgraph, but can lead to deadlocks when running migrations that need to lock subgraph_deployment.

To reduce the risk of such a deadlock, the code should be changed to read from subgraph_deployment outside of the write transaction; since we are use the READ_COMMITTED transaction isolation level, reading inside the transaction doesn't really bring any benefit, anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions