Skip loading chunks below a dataset's scheduled from block#45
Open
elina-chertova wants to merge 1 commit into
Open
Skip loading chunks below a dataset's scheduled from block#45elina-chertova wants to merge 1 commit into
from block#45elina-chertova wants to merge 1 commit into
Conversation
When a dataset is added with a high `from` offset, the scheduler downloaded a summary (an S3 GET + parquet parse) for every chunk from block 0, even though `weight::prepare_chunks` discards every chunk starting below `from`. For a large new dataset this exhausts `dataset_load_timeout_sec` before reaching the scheduled range, delaying the assignment upload and staling the scheduler. Thread the dataset's minimum scheduled block down to the chunk loader and skip the summary download for chunks that start below it.
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.
Problem
The tethys (testnet)
cron-schedulerwent stale on 2026-06-30 (testnet_scheduler_stale). Trigger: the datasetethereum-mainnet-3(from: 25000000,weight: 3) was added to the tethys scheduler config. Its first run had to enumerate the dataset from scratch.From the scheduler logs (
testnet-control-plane, podcron-scheduler-29713660):The 614s load pushed the 20-min cron cadence to ~30 min, so the last-assignment age crossed the staleness threshold (alert value
1821s).Crucially, all 18999 chunks it spent the 600s budget on were blocks
0 → ~2.36M— entirely belowfrom: 25000000, soweight::prepare_chunksdiscards every one of them. The run never even reached the scheduled range. The scheduler was paying for an S3 GET + parquet parse on millions of chunks it then throws away.Fix
Thread each dataset's minimum scheduled block (
segments[0].from, when it's an absolute non-negative offset) down to the chunk loader, and skip the summary download for chunks that start below it — mirroring the filterweight::prepare_chunksalready applies. Datasets withfrom: 0(the common case) and head-relative negative offsets are unaffected (from_block = None, previous behavior preserved).This removes the wasted work, so a newly added high-
fromdataset loads only its schedulable chunks and the assignment is published on time.Test
skips_chunks_below_dataset_frominsrc/storage.rsasserts the skip predicate matchesweight's keep rule (kept iffstart >= from), including a straddling chunk and theNone(no-bound) case. It fails on the pre-fix behavior (all chunks kept) and passes after — verified locally red→green.Verified locally:
cargo test --all-features(24 pass, 5 ignored S3 integration tests),cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D clippy::correctness -D clippy::suspicious -D perf— all green.Falsification
If after this change the scheduler still stalls loading a freshly added high-
fromdataset, the bottleneck is elsewhere (e.g. listing the schedulable range itself, or an S3 hang — see #44).Related to #35 (the dataset load timeout) and #44 (bounded S3 op timeouts) — different cause: those bound how long loading can take; this removes work that should never have been done.