Skip to content

fix: sort insert_snapshot_refs, remove early return and add 40P01 as retry-able error - #2117

Merged
brgr-s merged 2 commits into
mainfrom
stephan/vak-721-concurrent-commits-to-one-table-deadlock-on-table_refs-and
Oct 13, 2026
Merged

brgr-s merged 2 commits into
mainfrom
stephan/vak-721-concurrent-commits-to-one-table-deadlock-on-table_refs-and

Conversation

@brgr-s

@brgr-s brgr-s commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

retryable error.

Summary by CodeRabbit

  • Bug Fixes
    • Snapshot reference removals now remain in effect after a table is reloaded, while existing snapshots are preserved.
    • Moving a snapshot reference updates only that reference, leaving other references unchanged.
    • Tables with no snapshot references are handled correctly, and unchanged reference values are not unnecessarily updated.
    • Snapshot references are processed consistently, and PostgreSQL deadlock errors are reported as transaction-related failures.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7599565e-a8a5-499b-bb73-4cb05a0d3971
📥 Commits

Reviewing files that changed from the base of the PR and between fdec784 and 2a87df4.

⛔ Files ignored due to path filters (1)
  • .sqlx/query-4befa163d4cb730ea18ef96d90b08384cc6779f44c62cf063cdd8419891259bc.json is excluded by !.sqlx/**
📒 Files selected for processing (1)
  • crates/lakekeeper-storage-postgres/src/tabular/table/commit.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

Walkthrough

PostgreSQL error conversion now classifies code 40P01 as a transaction-related error. Snapshot reference insertion processes empty input and updates conflicting rows only when reference values differ. Tests cover reference removal and moving one reference without changing other reference rows.

Changes

PostgreSQL Error Classification

Layer / File(s) Summary
Map deadlock errors
crates/lakekeeper-storage-postgres/src/dbutils.rs
Both SQLx error conversion methods map PostgreSQL code 40P01 to their existing transaction-related classifications.

Snapshot Reference Persistence

Layer / File(s) Summary
Persist and verify snapshot reference changes
crates/lakekeeper-storage-postgres/src/tabular/table/common.rs, crates/lakekeeper-storage-postgres/src/tabular/table/commit.rs
Insertion proceeds when there are no references. Non-empty references are ordered by name, and conflicts update values only when the snapshot ID or retention differs. Regression tests check that removing a reference persists after reload and that moving main leaves the dev and v1 rows unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: c-thiel

Merge Risk: ⚪ Minimal · up to 2a87d

No merge-blocking issue is identified; this change is mergeable after normal checks.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: sorting insert_snapshot_refs, removing its early return, and classifying PostgreSQL error 40P01 as retryable.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the refs at night
The rows stay still when values match
main hops on to snapshot two
Old snapshots rest in quiet grass
Deadlock codes get names made clear
The burrow’s tests confirm the view

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 13, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 13, 2026
@brgr-s
brgr-s force-pushed the stephan/vak-721-concurrent-commits-to-one-table-deadlock-on-table_refs-and branch from fdec784 to 2a87df4 Compare October 13, 2026 12:19
@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@brgr-s

brgr-s commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #2110

@brgr-s
brgr-s merged commit 7c007ff into main Oct 13, 2026
74 checks passed
@brgr-s
brgr-s deleted the stephan/vak-721-concurrent-commits-to-one-table-deadlock-on-table_refs-and branch October 13, 2026 14:41
brgr-s added a commit that referenced this pull request Oct 15, 2026
brgr-s added a commit that referenced this pull request Oct 15, 2026
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

Successfully merging this pull request may close these issues.

1 participant