relaymonitor: page forward-fill through dense windows - #883
Open
damilolaedwards wants to merge 1 commit into
Open
damilolaedwards wants to merge 1 commit into
damilolaedwards wants to merge 1 commit into
Conversation
Forward-fill fetched one page per tick and advanced the cursor to the highest slot in the response. On a relay with many builder submissions per slot, a single limit-capped page can return only the top few slots of the requested range, so the cursor jumped straight to the top of the window while the slots below it were never fetched. Because forward-fill only ever moves the cursor forward, those slots were skipped for good. fetchForwardFillWindow now pages down through the window, lowering the cursor to just below the lowest slot seen each time the response comes back truncated, until the window is fully covered down to the current position or a page budget is hit. The cursor is only advanced once the whole window is proven covered. If the budget runs out on a very dense window, the location is left unchanged and the same window is retried on the next tick rather than silently skipping part of it. Added tests covering both cases: a window that pages through cleanly within the budget, and one dense enough that it should make no progress rather than a partial, gap-creating one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Forward-fill fetched one page per tick and advanced the cursor to the highest slot in the response. On a relay with many builder submissions per slot, a single limit-capped page can return only the top few slots of the requested range, so the cursor jumped straight to the top of the window while the slots below it were never fetched. Because forward-fill only ever moves the cursor forward, those slots were skipped for good.
fetchForwardFillWindow now pages down through the window, lowering the cursor to just below the lowest slot seen each time the response comes back truncated, until the window is fully covered down to the current position or a page budget is hit. The cursor is only advanced once the whole window is proven covered. If the budget runs out on a very dense window, the location is left unchanged and the same window is retried on the next tick rather than silently skipping part of it.
Test plan
go build ./...go test ./pkg/relaymonitor/... -race