Fix snapshot disk space check to run before download - #12861
Conversation
The 2.5x guard ran at the extraction stage, after the tarball was already on disk, so passing it effectively required ~3.5x the snapshot in volume space. Probe the snapshot size upfront and demand the remaining download bytes plus a 1.5x extraction estimate before downloading; at extraction demand only the 1.5x estimate. The pre-check runs outside the retry loop so low disk aborts instead of retrying forever.
|
Claude finished @svlachakis's task in 8m 49s —— View job Review: snapshot disk space check before download
The core diagnosis is right and the fix is well-targeted. The old Below are the issues worth resolving. Nothing here is Critical; the two Mediums are about the new guard failing open or failing wrong rather than about the arithmetic. High1. The new test project will never run in CI. Medium2. A probe timeout escapes the graceful-skip filter and aborts node startup. (inline) The 3. One transient probe failure silently disables the guard entirely. (inline) The download has exponential backoff; the probe gets a single attempt. A 503 or connection reset → 4. The requirement sums bytes destined for two volumes but checks only one. (inline) Low5. 6. The 7. Test nits. (fixture, coverage) Silent Things I checked that are fine
Note: Verdict: not mergeable as-is — findings 2, 3, and 4 should be addressed or explicitly acknowledged with rationale, and finding 1 (CI matrix) means the tests this PR adds currently provide no protection. |
Review follow-ups: a probe timeout no longer aborts startup but skips the pre-check like other transient probe failures; the download and extraction requirements are charged to the volumes that actually receive the bytes when SnapshotDirectory and BaseDbPath differ, with a fallback to the combined check when drive detection yields nothing; the new test project joins the CI test matrix; E2E tests pin the two pre-check skip paths (missing Content-Length, transient probe failure).
|
@claude review again |
|
included in #12862 |
Changes
Snapshot.SnapshotDirectoryandInit.BaseDbPathlive on different volumes, the pre-download check charges the remaining download bytes to the archive volume and the extraction estimate to the database volume; when they share a volume the requirements are summed, and when drive detection yields nothing the combined check against the database volume is kept as a conservative fallback.Nethermind.Init.Snapshot.Testproject (wired into the CI test matrix) covering: extraction proceeding with free space between 1.5x and 2.5x (fails against the old guard), extraction rejected below the estimate, the download rejected upfront with no bytes fetched when the volume cannot fit download plus extraction, the requirement arithmetic for fresh and resumed downloads, and the two pre-check skip paths completing end to end (server reporting no Content-Length, and a transient probe failure followed by a successful download).Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?