feat: snapshot download improvements (crash safety, local mode, source switching)#174
Open
7layermagik wants to merge 5 commits intodevfrom
Open
feat: snapshot download improvements (crash safety, local mode, source switching)#1747layermagik wants to merge 5 commits intodevfrom
7layermagik wants to merge 5 commits intodevfrom
Conversation
Downloads now write to .partial files first, then atomically rename on successful completion. This prevents corrupted snapshots from crashes mid-download being used on the next run. Changes: - Write to .partial suffix during HTTP downloads - FinalizePartialDownload() atomically renames after success - CleanupPartialDownload() removes partials on error/cancellation - Skip .partial files in detectExistingSnapshots() - Clean .partial files in CleanSnapshotDownloadDir() on startup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add --full-snapshot and --incremental-snapshot CLI flags to allow building AccountsDB from user-provided snapshot files without downloading. Usage: mithril run --full-snapshot /path/to/snapshot.tar.zst --accounts-path /mnt/accounts If --incremental-snapshot is not provided but --full-snapshot is, Mithril will attempt to download a matching incremental from the network. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0469254 to
740cb10
Compare
Add ability to switch between snapshot sources during downloads by pressing 'n': - New SourceSelector tracks ranked Stage 2 sources for full snapshots - IncrementalSelector filters cached Stage 1 nodes by matching base slot - Keyboard listener in raw terminal mode detects 'n' and Ctrl+C - Ctrl+C properly restores terminal and sends SIGINT in raw mode - Partial downloads cleaned up when switching sources - Shows source info and hints during download progress For incremental snapshots, cached Stage 1 results are filtered by matching base slot and sorted by: within-threshold first, then freshness, then speed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Write comprehensive log file after Stage 2 selection with:
- All configuration parameters used for filtering
- Incremental base matching statistics
- Full snapshot slot distribution (unique slots and node counts)
- Ranked node details (top 50 with speed/RTT/version)
Log written to: /mnt/mithril-logs/snapshot-search-{runID}-{timestamp}.log
This makes it easy to share debugging info when snapshot search fails
or selects a suboptimal source.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The source info line (Source 1/6: ... [Press 'n' for next source]) is now printed once above the progress bars instead of being re-printed on every progress update, fixing the repeated lines issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
This PR improves the snapshot download experience with four features:
.partialsuffix - Downloads write to temporary files, renamed atomically on successChanges
Crash Safety (
.partialsuffix).partialfiles first, then atomically rename on successful completion.partialfiles on startupFiles:
bufmonreader.go,build_db.go,node.goLocal Snapshot Mode (
--bootstrap-mode=local-snapshot)--local-snapshot-path=/path/to/snapshots/Files:
node.go,config.goInteractive Source Switching
Files:
source_selector.go(new),progress.go,node.go,build_db_with_incr.goDetailed Speed Test Logging
/mnt/mithril-logs/snapshot-search-{runID}-{timestamp}.logFiles:
source_selector.go,snapshotdl.go,node.goTest plan
Crash safety
.partial→ final name.partialfile is cleaned on next startupLocal snapshot mode
--bootstrap-mode=local-snapshot --local-snapshot-path=/pathloads from diskSource switching
Detailed logging
🤖 Generated with Claude Code