VictoriaMetrics/lib/fs
Roman Khavronenko 548bf31dd2
app/vmselect: make vmselect resilient to absence of cache folder (#5987)
vmselect uses a cache folder in file system for two purposes:
1. Storing rollup cache results on shutdown;
2. Storing temporary search results from vmstorage during query executions.

It could happen that cache folder is deleted accidentally by user, or by OS
during cleanup routines. This would cause vmselect to:
1. panic on /metrics call, because `MustGetFreeSpace` will fail;
2. return query error user, as it won't be able to store temporary search results.

The changes in this commit are the following:
1. Make `MustGetFreeSpace` to try re-creating the cache folder if it is missing;
2. Make vmselect to try re-creating the cache folder if it can't persist tmp search
results.

https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5985

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
(cherry picked from commit cb23685681)
2024-03-26 15:27:32 +01:00
..
fscore all: allow dynamically reading *AuthKey flag values from files and urls 2024-01-22 01:23:23 +02:00
dir_remover.go lib/mergeset: atomically remove part dirs 2022-09-13 15:56:33 +03:00
fadvise_darwin.go app/vmselect/promql: follow-up for ce4f26db02 2024-01-16 22:13:13 +02:00
fadvise_openbsd.go lib/fs: fix GOOS=openbsd build by adding fadviseSequentialRead implementation. 2020-10-05 23:32:28 +03:00
fadvise_solaris.go fixes solaris build (#1345) 2021-06-04 11:56:06 +03:00
fadvise_unix.go all: cleanup: remove // +build ... lines, since they are no longer needed after Go1.17, and the minimum supported Go version for VictoriaMetrics source code is Go1.20 2023-11-13 19:15:42 +01:00
fs.go app/vmselect: make vmselect resilient to absence of cache folder (#5987) 2024-03-26 15:27:32 +01:00
fs_nix.go lib: consistently use atomic.* types instead of atomic.* functions 2024-02-24 02:10:04 +02:00
fs_openbsd.go lib: consistently use atomic.* types instead of atomic.* functions 2024-02-24 02:10:04 +02:00
fs_solaris.go lib: consistently use atomic.* types instead of atomic.* functions 2024-02-24 02:10:04 +02:00
fs_test.go all: allow dynamically reading *AuthKey flag values from files and urls 2024-01-22 01:23:23 +02:00
fs_unix.go all: cleanup: remove // +build ... lines, since they are no longer needed after Go1.17, and the minimum supported Go version for VictoriaMetrics source code is Go1.20 2023-11-13 19:15:42 +01:00
fs_windows.go lib/fs: fix GOOS=windows build after f8baf29b6e 2024-03-01 01:46:44 +02:00
reader_at.go lib: consistently use atomic.* types instead of atomic.* functions 2024-02-24 02:10:04 +02:00
reader_at_test.go all: use os.{Read|Write}File instead of ioutil.{Read|Write}File 2022-08-21 23:55:20 +03:00
reader_at_timing_test.go all: use os.{Read|Write}File instead of ioutil.{Read|Write}File 2022-08-21 23:55:20 +03:00