Skip to content

Share the retry rule and copy budget helpers - #1183

Merged
kvch merged 1 commit into
mainfrom
passthrough/enablers
Sep 10, 2026
Merged

Share the retry rule and copy budget helpers#1183
kvch merged 1 commit into
mainfrom
passthrough/enablers

Conversation

@kvch

@kvch kvch commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Three small extractions so that a second component can reuse the postgres target behaviour the bulk ingest writer already implements: how a failure is classified as retriable, which retry policy applies once the default is resolved, and how large the concurrent COPY budget may be.

Nothing changes about what any of them decide. Each is a move or an extraction, verified by the existing tests.

This is the first of four stacked PRs splitting #1129. On its own it adds no functionality; the consumer arrives in the branch above it.

Related Issue(s)

Type of Change

  • 🔧 Refactoring (no functional changes)

Changes Made

  • Extract the retrying querier's classification into an exported retrier.IsRetriableError
  • Move CopyBudgetReserve and CopyBudgetSize from pkg/wal/processor/postgres to internal/sync, next to the weighted semaphore they size
  • Add Config.EffectiveRetryPolicy, returning the postgres writer's retry policy once its default has been applied. retryPolicy stays unexported and remains the single definition.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Code is well-commented
  • Documentation updated where necessary

@kvch kvch added the ai-review Set for simple PRs that does not require human approval label Sep 10, 2026

@xata-bot xata-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by the pgstream review agent.

This is a pure mechanical extraction/export of existing logic (retry classification, copy budget sizing, retry policy accessor) with no behavioral change; tests were updated in lockstep and verify identical outputs.

tier T1-agent · 4 files / 28 substantive lines · risk low. This is an automated review and does not replace human judgement on anything it escalates.

@kvch
kvch enabled auto-merge (squash) September 10, 2026 13:21
@github-actions

Copy link
Copy Markdown

Coverage

Total: 62.7% (±0.0% vs main)

Coverage in packages changed by this PR:

Package Coverage Δ
internal/postgres/retrier 92.0% +0.1%
internal/sync 5.0% +5.0%
pkg/wal/processor/postgres 88.8% -0.1%

@kvch
kvch merged commit bd6ae73 into main Sep 10, 2026
16 checks passed
@kvch
kvch deleted the passthrough/enablers branch September 10, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Set for simple PRs that does not require human approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants