fix(git): stage parallel snapshot temp file on target filesystem#363
Conversation
Parallel restore wrote the whole compressed snapshot to the default temp dir, which can fail with ENOSPC on hosts where /tmp is a small or separate tmpfs even when the target directory has room. Stage it under the target directory's parent (same filesystem, created if missing) instead. Add an end-to-end parallel restore test covering this.
3ba2583 to
83f41d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ba2583fb5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if err := os.MkdirAll(tmpDir, 0o750); err != nil { | ||
| return "", "", errors.Wrap(err, "create snapshot temp dir") | ||
| } | ||
| tmp, err := os.CreateTemp(tmpDir, ".cachew-snapshot-*.tar.zst") |
There was a problem hiding this comment.
Avoid requiring writes to the restore parent
When Directory already exists and is writable but its parent is not (for example a CI workspace pre-created/chowned for the job under a root-owned parent), snapshot.Extract can succeed because it only needs to write inside c.Directory, but this new CreateTemp writes into filepath.Dir(c.Directory) and fails the parallel restore before extraction with permission denied. Consider staging in the existing target directory, or falling back when the parent cannot be written, while still keeping the temp file on the target filesystem.
Useful? React with 👍 / 👎.
Parallel restore wrote the whole compressed snapshot to the default temp
dir, which can fail with ENOSPC on hosts where /tmp is a small or
separate tmpfs even when the target directory has room. Stage it under
the target directory's parent (same filesystem, created if missing)
instead. Add an end-to-end parallel restore test covering this.