file storage crashes on startup when --file-directory does not exist yet
- Dominant language
- Go
- Stars
- 126
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
The `file` storage backend treats the configured directory as already existing. A fresh deployment that points `BLOB_ARCHIVER_FILE_DIRECTORY` / `--file-directory` at a new path can crash while `NewFileStorage` tries to initialize `backfill_processes` and `lockfile`.
### Code path
`common/storage/file.go` initializes the metadata files immediately after constructing `FileStorage`, but it never creates `dir` first. If `dir` is missing, the first `os.WriteFile(path.Join(s.directory, "backfill_processes"), ...)` fails with `no such file or directory` and the constructor logs `Crit`.
### Expected behavior
The file backend should create its storage directory before initializing metadata files, matching the behavior users expect from a new on-disk backend deployment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in common/storage/file.go at NewFileStorage and follow the initialization of backfill_processes and lockfile. Verify the behavior with a storage directory that does not yet exist, and consider the issue complete when a fresh file backend creates the directory and initializes its metadata files without a startup error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100