mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: fix collect downsampling metrics (#489)
* lib/storage: fix downsampling * lib/storage: update logic * lib/storage: fix comments, removed unneeded check
This commit is contained in:
parent
fc3d826d7f
commit
693a3de0a6
2 changed files with 6 additions and 5 deletions
|
@ -1224,10 +1224,6 @@ func atomicSetBool(p *uint64, b bool) {
|
||||||
|
|
||||||
func (pt *partition) runFinalDedup() error {
|
func (pt *partition) runFinalDedup() error {
|
||||||
requiredDedupInterval, actualDedupInterval := pt.getRequiredDedupInterval()
|
requiredDedupInterval, actualDedupInterval := pt.getRequiredDedupInterval()
|
||||||
if requiredDedupInterval <= actualDedupInterval {
|
|
||||||
// Deduplication isn't needed.
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
logger.Infof("starting final dedup for partition %s using requiredDedupInterval=%d ms, since the partition has smaller actualDedupInterval=%d ms",
|
logger.Infof("starting final dedup for partition %s using requiredDedupInterval=%d ms, since the partition has smaller actualDedupInterval=%d ms",
|
||||||
pt.bigPartsPath, requiredDedupInterval, actualDedupInterval)
|
pt.bigPartsPath, requiredDedupInterval, actualDedupInterval)
|
||||||
|
@ -1238,6 +1234,11 @@ func (pt *partition) runFinalDedup() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pt *partition) isFinalDedupNeeded() bool {
|
||||||
|
requiredDedupInterval, actualDedupInterval := pt.getRequiredDedupInterval()
|
||||||
|
return requiredDedupInterval > actualDedupInterval
|
||||||
|
}
|
||||||
|
|
||||||
func (pt *partition) getRequiredDedupInterval() (int64, int64) {
|
func (pt *partition) getRequiredDedupInterval() (int64, int64) {
|
||||||
pws := pt.GetParts(nil, false)
|
pws := pt.GetParts(nil, false)
|
||||||
defer pt.PutParts(pws)
|
defer pt.PutParts(pws)
|
||||||
|
|
|
@ -466,7 +466,7 @@ func (tb *table) finalDedupWatcher() {
|
||||||
timestamp := timestampFromTime(time.Now())
|
timestamp := timestampFromTime(time.Now())
|
||||||
currentPartitionName := timestampToPartitionName(timestamp)
|
currentPartitionName := timestampToPartitionName(timestamp)
|
||||||
for _, ptw := range ptws {
|
for _, ptw := range ptws {
|
||||||
if ptw.pt.name == currentPartitionName {
|
if ptw.pt.name == currentPartitionName || !ptw.pt.isFinalDedupNeeded() {
|
||||||
// Do not run final dedup for the current month.
|
// Do not run final dedup for the current month.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue