Skip to content

spock_apply: run exception-log work in ApplyOperationContext#499

Open
ibrarahmad wants to merge 6 commits into
v5_STABLEfrom
MEM_CONSUM
Open

spock_apply: run exception-log work in ApplyOperationContext#499
ibrarahmad wants to merge 6 commits into
v5_STABLEfrom
MEM_CONSUM

Conversation

@ibrarahmad

Copy link
Copy Markdown
Contributor

After RollbackAndReleaseCurrentSubTransaction the current memory context is TopTransactionContext, so per-row palloc in log_insert_exception accumulated for the whole apply transaction. Switch to ApplyOperationContext for the exception-log body and reset that context per message in handle_update and handle_delete.

Cycle | Before | After | Reduction
-- | -- | -- | --
1 | 446 MB | 110 MB | 75.3%
2 | 433 MB | 264 MB | 39.0%
3 | 609 MB | 310 MB | 49.1%
Average |   |   | 54.5%

After RollbackAndReleaseCurrentSubTransaction the current memory
context is TopTransactionContext, so per-row palloc in
log_insert_exception accumulated for the whole apply transaction.
Switch to ApplyOperationContext for the exception-log body and
reset that context per message in handle_update and handle_delete.
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b6ae671a-b029-48e3-8390-d1eab552635c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MEM_CONSUM

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

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

@codacy-production

codacy-production Bot commented Jun 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ibrarahmad ibrarahmad requested a review from mason-sharp June 11, 2026 15:00
@ibrarahmad ibrarahmad self-assigned this Jun 11, 2026
@ibrarahmad ibrarahmad added the enhancement New feature or request label Jun 11, 2026
Ibrar Ahmed added 5 commits June 11, 2026 21:46
Trigger the use_try_block retry path by killing the apply worker
mid-transaction with sub_disable, then re-enabling so the new worker
matches its prior commit_lsn. Poll memory context snapshots while
apply is mid-transaction and assert TopTransactionContext stays well
under the pre-fix per-row growth.
Shorten the verbose MemoryContextSwitchTo comment, drop the brittle
"level: 2;" prefix from 022's three context regexes, and add use lib 't'.
…ndler

Replace the per-handler MemoryContextReset calls with a single reset
after each dispatched message instead of scattering them in handle_*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant