Skip to content

feat(pg-performance): start read transactions in one round trip - #2146

Merged
c-thiel merged 1 commit into
mainfrom
christian/begin-read-only
Oct 19, 2026
Merged

c-thiel merged 1 commit into
mainfrom
christian/begin-read-only

Conversation

@c-thiel

@c-thiel c-thiel commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Read transactions, such as those of paged listings, start with BEGIN READ ONLY. This saves one database round trip each time a read transaction starts. They still refuse writes; a new test checks that.

Summary by CodeRabbit

  • Bug Fixes
    • Read-only transactions now reject attempts to create temporary tables, preventing changes that are not allowed in read-only mode. This keeps transaction behavior consistent with its read-only status.

begin_read starts its transaction with BEGIN READ ONLY, so starting the transaction and making it read-only take one round trip.
@coderabbitai

coderabbitai Bot commented Oct 19, 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: 70ab42c8-a052-4dd7-9d18-aefb992678f7
📥 Commits

Reviewing files that changed from the base of the PR and between 969b8e9 and cf9cd10.

📒 Files selected for processing: 1
  • crates/lakekeeper-storage-postgres/src/lib.rs

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

Walkthrough

begin_read now starts PostgreSQL transactions with BEGIN READ ONLY. A test checks that creating a temporary table in a read transaction returns error code 25006.

Changes

PostgreSQL Read-Only Transactions

Layer / File(s) Summary
Read-only transaction startup and validation
crates/lakekeeper-storage-postgres/src/lib.rs
begin_read starts a read-only transaction directly while retaining acquisition-timeout metrics and transaction-start error mapping. A test verifies that CREATE TEMP TABLE fails with PostgreSQL error code 25006. The unused Executor import was removed.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: brgr-s

Merge Risk: ⚪ Minimal · up to cf9cd

Read transactions now start read-only in one database round trip and still reject writes. No merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 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.
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.
Title check Passed The title clearly and concisely describes the main change: starting PostgreSQL read transactions in one round trip.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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 read-only gate
No temp table can change its state
BEGIN READ ONLY starts the ride
Error 25006 confirms the guide
Then hops away, content and light

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

@c-thiel c-thiel changed the title perf(postgres): start read transactions in one round trip feat(pg-performance): start read transactions in one round trip Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

@c-thiel
c-thiel enabled auto-merge (squash) October 19, 2026 19:34
@c-thiel
c-thiel merged commit de33178 into main Oct 19, 2026
84 of 87 checks passed
@c-thiel
c-thiel deleted the christian/begin-read-only branch October 19, 2026 19:37
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