Skip to content

fix(master): page the demand listing; stop treating average size as max - #367

Merged
beinan merged 1 commit into
lance-format:mainfrom
beinan:fix/demand-route-paged
Oct 9, 2026
Merged

beinan merged 1 commit into
lance-format:mainfrom
beinan:fix/demand-route-paged

Conversation

@beinan

@beinan beinan commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Part of #333. Fixes the two code findings of review round 7 (credit: production review), which otherwise cleared a single-master shadow canary in production.

# Finding Fix
1 GET /scheduler/demand list mode still one unpaged read → fails at 13k tables Paged read reduced to a bounded summary: pending-sorted, limit (default 200, max 2000), include_idle, total_tables/tables_with_pending. Full record only for ?target=. Response size independent of cache size.
2 Byte estimate used pending_bytes / pending_generations (an average) as the max Every shadow reservation is the executor's whole local budget — the only honest value for an unknown max. Spec now says the shadow capacity model answers "can one unit fit", not parallelism; placement_gap must not be read as such. planner_shadow_reservation_basis_total{basis}, planner_shadow_average_generation_bytes record the basis.

Validation

Planner etcd test extended: list view with limit=1 returns only the pending table, record omitted, total_tables=2, tables_with_pending=1. 18 planner/routes tests green; clippy -D warnings, fmt, typos clean. Spec §2.3 and observability list updated.

Finding 3 (real-traffic observation: master RSS, etcd latency, reconcile completion, merge progress, pending/503) is the canary itself, not code.

🤖 Generated with Claude Code

Review round 7, two code findings.

GET /scheduler/demand without a target still did one unpaged prefix
read of the whole cache, so at 13k tables it failed the same 4 MiB cap
the planner was fixed for in lance-format#364. The listing is now a paged read
reduced to a bounded summary: pending-sorted, default 200 and at most
2000 rows, idle tables excluded unless include_idle=true, with
total_tables and tables_with_pending alongside. The full TableDemand
record is returned only for a single-target query. Response size is now
independent of cache size.

The shadow byte estimate used pending_bytes / pending_generations - an
average - where a maximum belongs. The append path reads a whole
generation before checking the per-pass target, so the largest single
generation is the real floor, and no publisher reports per-generation
sizes yet. The estimate is now the executor's whole local budget for
every unit, which is the only honest reservation for an unknown
maximum. The spec says plainly that this makes the shadow capacity
model answer "can one unit fit" and not "how many in parallel", and
that placement_gap must not be read as a parallelism measurement.
planner_shadow_reservation_basis_total{basis} and
planner_shadow_average_generation_bytes record what each reservation
was based on.

Tests: the planner etcd test now also exercises the list view - paged,
limit=1 returns only the pending table, record omitted, totals correct.
18 planner/routes tests pass; clippy -D warnings, fmt, typos clean.

Refs lance-format#333. Review round 7.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@beinan
beinan merged commit 8e6d7de into lance-format:main Oct 9, 2026
11 checks passed
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.

1 participant