mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
lib/storage: allow set values higher than 1 for vm_merge_need_free_disk_space
if there are multiple partitions with deferred merges due to disk space shortage
This commit is contained in:
parent
44bcda81ab
commit
bec9b31b81
@ -1175,7 +1175,9 @@ VictoriaMetrics also exposes currently running queries with their execution time
|
|||||||
has at least 20% of free space comparing to disk size. The remaining amount of free space
|
has at least 20% of free space comparing to disk size. The remaining amount of free space
|
||||||
can be [monitored](#monitoring) via `vm_free_disk_space_bytes` metric. The total size of data
|
can be [monitored](#monitoring) via `vm_free_disk_space_bytes` metric. The total size of data
|
||||||
stored on the disk can be monitored via sum of `vm_data_size_bytes` metrics.
|
stored on the disk can be monitored via sum of `vm_data_size_bytes` metrics.
|
||||||
See also `vm_merge_need_free_disk_space` metrics, which are set to 1 if background merge cannot be initiated due to free disk space shortage.
|
See also `vm_merge_need_free_disk_space` metrics, which are set to values higher than 0
|
||||||
|
if background merge cannot be initiated due to free disk space shortage. The value shows the number of per-month partitions,
|
||||||
|
which would start background merge if they had more free disk space.
|
||||||
|
|
||||||
* If VictoriaMetrics doesn't work because of certain parts are corrupted due to disk errors,
|
* If VictoriaMetrics doesn't work because of certain parts are corrupted due to disk errors,
|
||||||
then just remove directories with broken parts. This will recover VictoriaMetrics at the cost
|
then just remove directories with broken parts. This will recover VictoriaMetrics at the cost
|
||||||
|
@ -123,6 +123,9 @@ type partition struct {
|
|||||||
|
|
||||||
smallAssistedMerges uint64
|
smallAssistedMerges uint64
|
||||||
|
|
||||||
|
smallMergeNeedFreeDiskSpace uint64
|
||||||
|
bigMergeNeedFreeDiskSpace uint64
|
||||||
|
|
||||||
mergeIdx uint64
|
mergeIdx uint64
|
||||||
|
|
||||||
smallPartsPath string
|
smallPartsPath string
|
||||||
@ -392,8 +395,8 @@ func (pt *partition) UpdateMetrics(m *partitionMetrics) {
|
|||||||
|
|
||||||
m.SmallAssistedMerges += atomic.LoadUint64(&pt.smallAssistedMerges)
|
m.SmallAssistedMerges += atomic.LoadUint64(&pt.smallAssistedMerges)
|
||||||
|
|
||||||
m.SmallMergeNeedFreeDiskSpace = atomic.LoadUint64(&smallMergeNeedFreeDiskSpace)
|
m.SmallMergeNeedFreeDiskSpace += atomic.LoadUint64(&pt.smallMergeNeedFreeDiskSpace)
|
||||||
m.BigMergeNeedFreeDiskSpace = atomic.LoadUint64(&bigMergeNeedFreeDiskSpace)
|
m.BigMergeNeedFreeDiskSpace += atomic.LoadUint64(&pt.bigMergeNeedFreeDiskSpace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddRows adds the given rows to the partition pt.
|
// AddRows adds the given rows to the partition pt.
|
||||||
@ -999,7 +1002,7 @@ func (pt *partition) mergeBigParts(isFinal bool) error {
|
|||||||
pws, needFreeSpace := getPartsToMerge(pt.bigParts, maxRows, isFinal)
|
pws, needFreeSpace := getPartsToMerge(pt.bigParts, maxRows, isFinal)
|
||||||
pt.partsLock.Unlock()
|
pt.partsLock.Unlock()
|
||||||
|
|
||||||
atomicSetBool(&bigMergeNeedFreeDiskSpace, needFreeSpace)
|
atomicSetBool(&pt.bigMergeNeedFreeDiskSpace, needFreeSpace)
|
||||||
return pt.mergeParts(pws, pt.stopCh)
|
return pt.mergeParts(pws, pt.stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,7 +1021,7 @@ func (pt *partition) mergeSmallParts(isFinal bool) error {
|
|||||||
pws, needFreeSpace := getPartsToMerge(pt.smallParts, maxRows, isFinal)
|
pws, needFreeSpace := getPartsToMerge(pt.smallParts, maxRows, isFinal)
|
||||||
pt.partsLock.Unlock()
|
pt.partsLock.Unlock()
|
||||||
|
|
||||||
atomicSetBool(&smallMergeNeedFreeDiskSpace, needFreeSpace)
|
atomicSetBool(&pt.smallMergeNeedFreeDiskSpace, needFreeSpace)
|
||||||
return pt.mergeParts(pws, pt.stopCh)
|
return pt.mergeParts(pws, pt.stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,11 +1035,6 @@ func atomicSetBool(p *uint64, b bool) {
|
|||||||
atomic.StoreUint64(p, v)
|
atomic.StoreUint64(p, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
smallMergeNeedFreeDiskSpace uint64
|
|
||||||
bigMergeNeedFreeDiskSpace uint64
|
|
||||||
)
|
|
||||||
|
|
||||||
// mergeParts merges pws.
|
// mergeParts merges pws.
|
||||||
//
|
//
|
||||||
// Merging is immediately stopped if stopCh is closed.
|
// Merging is immediately stopped if stopCh is closed.
|
||||||
|
Loading…
Reference in New Issue
Block a user