Skip to content

fix(preheat): batch paths-info when sizing a snapshot - #127

Merged
mangoknight merged 1 commit into
dingodb:mainfrom
mangoknight:fix/preheat-batch-paths-info
Oct 13, 2026
Merged

mangoknight merged 1 commit into
dingodb:mainfrom
mangoknight:fix/preheat-batch-paths-info

Conversation

@mangoknight

@mangoknight mangoknight commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

preheatMetadata sized the snapshot by issuing one paths-info request per file, serially, inside the create request. Repositories with more than a few dozen files exceeded the caller's timeout and job creation failed with context canceled.

Fix

FileDao.GetPathsSizesContext sends paths-info in batches of 128 (as remote_sync does) and errors if the response is missing or adds paths. preheatMetadata uses it.

Tests

TestPreheatMetadataBatchesPathsInfo: 200 files take 2 requests with correct total size; a missing path is an error. The old code issued 200 requests.

🤖 Generated with Claude Code

preheatMetadata posted one paths-info request per file, serially, inside
the cache-job create request. Through a regional proxy each call takes
~0.75s, so a dataset with 167 files (CASIA-LM/ChineseWebText2.0) needed
~2 minutes while the scheduler cancels after 10s and preparation is
bounded at 45s: create always failed with "context canceled" for any
repository with more than a dozen files. Introduced in 5bcef49.

Query sizes with one paths-info request per 128 paths (same batching as
remote_sync) and reject responses that miss or add paths.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mangoknight
mangoknight added this pull request to the merge queue Oct 13, 2026
Merged via the queue into dingodb:main with commit 7a4877f Oct 13, 2026
1 check passed
mangoknight added a commit to mangoknight/dingospeed that referenced this pull request Oct 13, 2026
Creating a preheat job measured every file of the snapshot before
answering, inside the scheduler's 10s request. Batching paths-info
(dingodb#127) fixed repositories with a few hundred files, but uonlp/CulturaX
has 9059: 71 batches at 1-4s each through the regional exit, so create
still failed with "context canceled".

- Create only resolves the commit and file list (one request) and
  registers the job with the upstream usedStorage as an estimate.
- The task measures the snapshot first (Prepare), records the exact
  size locally and reports it to the scheduler, then transfers. A sizing
  failure now fails the job with its reason instead of the create call.
- Sizes come from one revision?blobs=true request (9059 files: 1.7s
  direct), falling back to batched paths-info when sizes are missing.
- Resume reports "running" with the size once preparation is done, so
  the scheduler no longer shows a resumed job as interrupted.
- Completed-job reuse checks against the size that job recorded, since
  a create request now only carries the estimate.
- proto: UpdateCacheJobStatusReq.usedStorage (field 8). The running
  report is best effort and never queued for replay, so it cannot land
  after a terminal status.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants