lablup / lablup/backend.ai

Replace DB connection retry with transaction-level retry for PostgreSQL serialization errors

Open
#3,131 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Current Behavior

- Manager currently handles PostgreSQL serialization errors using `ai.backend.manager.models.utils.execute_with_retry()`
- This implementation retries the entire database connection when errors occur
## Proposed Change

- Replace `execute_with_retry()` with `ai.backend.manager.models.utils.execute_with_txn_retry()`
- New implementation will retry only the transaction instead of the entire connection
### Reference

- #2088
- https://docs.sqlalchemy.org/en/20/core/connections.html#sqlalchemy.engine.Connection.begin
- https://docs.sqlalchemy.org/en/20/core/connections.html#sqlalchemy.engine.Engine.connect
### Related drafts

- https://github.com/lablup/backend.ai/pull/2091
- https://github.com/lablup/backend.ai/pull/2090
- https://github.com/lablup/backend.ai/pull/2103

JIRA Issue: BA-53

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.