mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: return dedup interval in milliseconds from GetDedupInterval()
This removes duplicate .Milliseconds() calls after GetDedupInterval() calls.
This commit is contained in:
parent
acd56603b0
commit
92070cbb67
3 changed files with 6 additions and 8 deletions
|
@ -468,8 +468,7 @@ func (pts *packedTimeseries) Unpack(dst *Result, tbf *tmpBlocksFile, tr storage.
|
|||
if firstErr != nil {
|
||||
return firstErr
|
||||
}
|
||||
di := storage.GetDedupInterval()
|
||||
dedupInterval := di.Milliseconds()
|
||||
dedupInterval := storage.GetDedupInterval()
|
||||
mergeSortBlocks(dst, sbs, dedupInterval)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -187,8 +187,7 @@ func (bsw *blockStreamWriter) MustClose() {
|
|||
func (bsw *blockStreamWriter) WriteExternalBlock(b *Block, ph *partHeader, rowsMerged *uint64, needDedup bool) {
|
||||
atomic.AddUint64(rowsMerged, uint64(b.rowsCount()))
|
||||
if needDedup {
|
||||
di := GetDedupInterval()
|
||||
dedupInterval := di.Milliseconds()
|
||||
dedupInterval := GetDedupInterval()
|
||||
b.deduplicateSamplesDuringMerge(dedupInterval)
|
||||
}
|
||||
headerData, timestampsData, valuesData := b.MarshalData(bsw.timestampsBlockOffset, bsw.valuesBlockOffset)
|
||||
|
|
|
@ -10,15 +10,15 @@ import (
|
|||
//
|
||||
// This function must be called before initializing the storage.
|
||||
func SetDedupInterval(dedupInterval time.Duration) {
|
||||
globalDedupInterval = dedupInterval
|
||||
globalDedupInterval = dedupInterval.Milliseconds()
|
||||
}
|
||||
|
||||
// GetDedupInterval returns the dedup interval set via SetDedupInterval.
|
||||
func GetDedupInterval() time.Duration {
|
||||
// GetDedupInterval returns the dedup interval in milliseconds, which has been set via SetDedupInterval.
|
||||
func GetDedupInterval() int64 {
|
||||
return globalDedupInterval
|
||||
}
|
||||
|
||||
var globalDedupInterval time.Duration
|
||||
var globalDedupInterval int64
|
||||
|
||||
// DeduplicateSamples removes samples from src* if they are closer to each other than dedupInterval in millseconds.
|
||||
func DeduplicateSamples(srcTimestamps []int64, srcValues []float64, dedupInterval int64) ([]int64, []float64) {
|
||||
|
|
Loading…
Reference in a new issue