mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: log a warning when the -storageDataPath has less than -storage.minFreeDiskSpaceBytes
This should improve the debuggability of the readonly feature. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1727
This commit is contained in:
parent
ca49853664
commit
93511b4be7
1 changed files with 6 additions and 1 deletions
|
@ -596,10 +596,15 @@ func (s *Storage) startFreeDiskSpaceWatcher() {
|
||||||
freeSpaceBytes := fs.MustGetFreeSpace(s.path)
|
freeSpaceBytes := fs.MustGetFreeSpace(s.path)
|
||||||
if freeSpaceBytes < freeDiskSpaceLimitBytes {
|
if freeSpaceBytes < freeDiskSpaceLimitBytes {
|
||||||
// Switch the storage to readonly mode if there is no enough free space left at s.path
|
// Switch the storage to readonly mode if there is no enough free space left at s.path
|
||||||
|
logger.Warnf("switching the storage at %s to read-only mode, since it has less than -storage.minFreeDiskSpaceBytes=%d of free space: %d bytes left",
|
||||||
|
s.path, freeDiskSpaceLimitBytes, freeSpaceBytes)
|
||||||
atomic.StoreUint32(&s.isReadOnly, 1)
|
atomic.StoreUint32(&s.isReadOnly, 1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
atomic.StoreUint32(&s.isReadOnly, 0)
|
if atomic.CompareAndSwapUint32(&s.isReadOnly, 1, 0) {
|
||||||
|
logger.Warnf("enabling writing to the storage at %s, since it has more than -storage.minFreeDiskSpaceBytes=%d of free space: %d bytes left",
|
||||||
|
s.path, freeDiskSpaceLimitBytes, freeSpaceBytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
f()
|
f()
|
||||||
s.freeDiskSpaceWatcherWG.Add(1)
|
s.freeDiskSpaceWatcherWG.Add(1)
|
||||||
|
|
Loading…
Reference in a new issue