Remove the PostgreSQL savepoint resource-owner depth limit - #66
Merged
Merged
Conversation
Test 62 is now 62_deferred_fk_caller_commit.sql, merged with #65. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
andinux
force-pushed
the
codex/postgres-savepoint-depth
branch
from
September 22, 2026 14:56
6ae57f4 to
5ac466a
Compare
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ing the suite Under ON_ERROR_STOP=on a failing apply stopped full_test.sql with no [FAIL] line. Each depth now records the SQLSTATE, recovers at the user savepoint and reports [FAIL] per check, so the rest of the suite runs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applying a payload read from a PostgreSQL table at 126 or more user savepoints could fail with
buffer pin ... is not owned by resource owner SubTransaction. The fixed 128-entry owner/context array silently stopped recording Cloudsync's additional internal subtransactions.Replace the array with a stack of frames allocated in
TopTransactionContext, keyed by subtransaction ID. Commit and rollback restore the caller's resource owner and memory context from a local copy. Subtransaction callbacks remove completed or externally aborted frames, and transaction callbacks clear the stack. Snapshot replacement remains limited to the outermost Cloudsync savepoint. PostgreSQL's own resource limits still apply, but Cloudsync no longer imposes the fixed depth cap.Validation
The test is included in
full_test.sql;docs/internal/deep-savepoints.mdexplains the defect, lifetime handling and results.This is one of three independent follow-ups to #64, now based on
mainafter #64 and #65 were squash-merged. The PostgreSQL test is numbered 63 (63_deep_savepoints.sql), since test 62 came in with #65. These tests run against local PostgreSQL instances, not a deployed cloud server.The cloud-integration reliability commit this branch used to carry was identical to the one merged with #65, so it was dropped in the rebase.
Validation after the rebase
Full PostgreSQL suite with
ON_ERROR_STOP=on: 553 checks pass on standalone PostgreSQL 17 and 551 on Supabase (test 39's lock-contention part skips there by design), including all 25 checks of test 63. CI run 35743888194 passed on the rebased head5ac466a.Test 63 now reports a failed apply as
[FAIL]with its SQLSTATE and recovers at the user savepoint, instead of stoppingfull_test.sqlunderON_ERROR_STOP=on. Negative control againstmain's build: depths 1 and 125 pass, and every apply and reapply from depth 126 up is reported[FAIL] … SQLSTATE XX000while the suite continues. The final caught-errors section at depth 256 still crashes an assertion-enabled server there (TRAP: failed Assert("portal->portalSnapshot == NULL")), which no psql script can recover from; the changelog entry mentions this effect of the old code.CHANGELOG.mdhas an[Unreleased]entry for the fix.