Skip to content

ScheduledMerges: fix a bug in maxPhysicalDebt and invariant #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jorisdral
Copy link
Collaborator

@jorisdral jorisdral commented Jun 19, 2025

Resolves #755

The prototype had a bug in the calculation of maxPhysicalDebt where it was not
considering that incoming runs that are inputs to a merge can be overfull. Runs
can be overfull because we hold back runs that are underfull. However, runs
should only be overfull in the sense that they are too large for their current
level. They can't be overfull with respect to the next level too.

This same bug occurred in invariant, where a similar change was made to
consider overfull runs properly.

Some other minor changes to invariant were made to make the checked invariant
a little more precise.

Note that the assertion failures only started appearing on CI runs after #716 and #717 were merged. I realised that it's a relatively rare scenario to create underfull and overfull runs, but less so if the size ratio and write buffer size are small. That's probably why we only just now started seeing the assertion failures.

This should help get a sense of *why* the assertion is failing
@jorisdral jorisdral self-assigned this Jun 19, 2025
The prototype had a bug in the calculation of `maxPhysicalDebt` where it was not
considering that incoming runs that are inputs to a merge can be overfull. Runs
can be overfull because we hold back runs that are underfull. However, runs
should only be overfull in the sense that they are too large for their current
level. They can't be overfull with respect to the next level too.

This same bug occurred in `invariant`, where a similar change was made to
consider overfull runs properly.

Some other minor changes to `invariant` were made to make the checked invariant
a little more precise.
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.

[BUG] An invariant assertion failed in the ScheduledMerges prototype.
1 participant