Skip to content

fix replication requests exceeding maxRoundWindow + splitting resends#431

Open
jadalsmail wants to merge 9 commits into
mainfrom
fix-replication-request-splitting
Open

fix replication requests exceeding maxRoundWindow + splitting resends#431
jadalsmail wants to merge 9 commits into
mainfrom
fix-replication-request-splitting

Conversation

@jadalsmail

@jadalsmail jadalsmail commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Motivation:
In resendReplicationRequests, timed-out sequences were compressed into contiguous segments and each segment was sent whole to a single node, which can be larger than maxRoundWindow. Thus, nodes drop such requests without responding, so a lagging node would resend the same oversized request forever and never catch up.

initial requests and timed-out retries now share a single send path. A new function, BatchSequences, which distributes seqs as evenly as possible among nodes, returning one batch per node share. Every batch contains at most maxSize sequences.

We also introduce a new variable, MaxRoundRequests, which is the max number of rounds or sequences that fit in one replication request. Every batch is capped at this size by construction. It is set to 10 to match DefaultMaxRoundWindow

Removed: CompressSequences, DistributeSequenceRequests, and the Segment type (plus their tests). the segment/range model they implemented is replaced by batching, and requests may now contain non-contiguous sequences (responders sort incoming requests).

Also, unit test + table tests (for BatchSequences) for testing this functionality were added.

@jadalsmail jadalsmail force-pushed the fix-replication-request-splitting branch from 7261a83 to a70872d Compare July 6, 2026 21:41
Comment thread simplex/util.go Outdated
Comment thread simplex/util.go Outdated
Comment thread simplex/util.go Outdated
Comment thread simplex/util_test.go Outdated
Comment thread simplex/requestor.go Outdated
Comment thread simplex/epoch.go Outdated
Comment thread simplex/requestor.go Outdated
Comment thread simplex/requestor.go
Comment thread simplex/requestor.go
Comment thread simplex/util.go Outdated
Comment thread simplex/util.go Outdated
Comment thread simplex/util.go Outdated
Comment thread simplex/util.go Outdated
Comment thread simplex/util_test.go

@yacovm yacovm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I also want to review this change before it gets merged so please don't merge it yet

@yacovm

yacovm commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes the following bug:

  • in resendReplicationRequests, we aggregate continuous sequences which can be larger than maxRoundWindow

Also, unit tests testing this functionality were added.

Can we please have a more descriptive and elaborate PR description?

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.

3 participants