Skip to content

🐛 fix(replication): enforce batch budgets - #1871

Merged
gaborbernat merged 1 commit into
mainfrom
fix/replication-budget-1139
Aug 30, 2026
Merged

gaborbernat merged 1 commit into
mainfrom
fix/replication-budget-1139

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

A peer could return a full page when a replication drain had one budget slot left. The drain retained the full page, and the HTTP transport reported a compact re-encoding size instead of the received body length. Insignificant JSON whitespace disappeared from frame accounting.

The drain caps each request at its remaining slots and rejects an over-count page before adding changes to the result. The HTTP transport enforces the same count bound after decoding and records the bounded wire length. The streaming cap still rejects a body before JSON decoding when it crosses the byte limit. 📦

Closes #1139

A drain could retain more changes than its caller's budget because each request
used the configured page size. HTTP frames replaced the received byte length
with a compact re-encoding.

Cap each request by the remaining slots and reject an oversized count before
extending the retained batch. Keep the bounded response length so whitespace
and exact byte limits remain part of the transport contract.
@gaborbernat gaborbernat added the bug Something isn't working label Aug 30, 2026
@gaborbernat gaborbernat self-assigned this Aug 30, 2026
@codspeed

codspeed Bot commented Aug 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 23 untouched benchmarks
⏩ 139 skipped benchmarks1


Comparing fix/replication-budget-1139 (e8e17f4) with main (60698d6)

Open in CodSpeed

Footnotes

  1. 139 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@gaborbernat
gaborbernat merged commit f1f414a into main Aug 30, 2026
32 checks passed
@gaborbernat
gaborbernat deleted the fix/replication-budget-1139 branch August 30, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce replication budgets before retaining a peer page

1 participant