Keep C: responsive during backups; add file logging, mount UI, RPC debounce #2
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/backup-io-priority-and-mount"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
On Windows, a folder backup (e.g. Downloads) made the whole C: drive feel
unavailable for the duration of the run. The system's own logs ruled out a
volume fault: no volsnap/Ntfs/disk error, only a benign "shadow copy healthy"
event. The cause is I/O starvation — the fstree walker read one
file per CPU (
GOMAXPROCS) with plain bufferedos.Openat normal I/Opriority and no throttle, saturating the disk queue and evicting the Windows
file cache. Two secondary problems surfaced alongside it: the service kept no
inspectable log (slog went to stderr, discarded under the SCM), and the TUI
spammed "multiple RPC errors" whenever the machine was busy or the service
restarted.
Changes
Keep C: responsive (priority)
platform.OpenBackupRead(backupfile_windows.go/backupfile_other.go):opens source files with
FILE_FLAG_SEQUENTIAL_SCANand a low per-handleI/O priority hint (
SetFileInformationByHandle,FileIoPriorityHintInfo),so backup reads are scheduled below interactive I/O and don't thrash the file
cache. Wired into the fstree content + ADS read path. This is per-handle, so
it never throttles the service's own RPC threads.
service.max_backup_read_concurrency(0 = auto =min(GOMAXPROCS, 4)),wired to
fstree.Options.WorkersviaDispatcher.SetBackupReadConcurrency(live-applied on settings update).
Inspectable logs
service.log_file, default<state_dir>/logs/kbackupd.log, rotated at 10 MiB), in addition to stderr.Dependency-free. This is what finally lets the service log be read under the
Windows SCM.
Tame transient RPC-error spam
the dashboard's 2s poll debounces transient failures and clears on recovery;
inherently-transient live-stream ends are no longer surfaced.
Mount / browse a snapshot from the TUI
mmounts the selected snapshot as a read-only drive(prompting for a mount point),
Mlists active mounts withuto unmount —reusing the already-built
MountService. Windows needs the WinFsp driver.Tests
Adds unit tests for the worker resolver, log rotation + path resolution,
OpenBackupRead(Windows), the new config validation, and the TUIheartbeat/dashboard debounce.
go build ./...,go vet ./..., andgo test ./...all pass.Not included / follow-up
mount, log-file creation under the live service) must be done on a disposable
Windows VM, not the maintainer's host.
held back because that file is part of separate, not-yet-committed installer
work; fold them in when that lands.
priority self-tunes).
kReview review
Verdict: no findings
No findings to address in the reviewed diff.
No meaningful correctness, security, or workflow regressions are provable from the supplied diff.
Reviewed by kReview at
67c13fbedd. This comment is conservative and based only on the PR diff and metadata.Est. cost ~$2.65 total (425.5k in / 22.0k out) · this run ~$0.29 (50.4k in / 1.9k out) / gpt-5.6-sol.