mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: convert dedupsDuringMerge from uint64 to atomic.Uint64
This should simplify code maintenance by gradually converting to atomic.* types instead of calling atomic.* functions
on int and bool types.
See ea9e2b19a5
This commit is contained in:
parent
ea9e2b19a5
commit
0f1ea36dc8
2 changed files with 3 additions and 3 deletions
|
@ -171,12 +171,12 @@ func (b *Block) deduplicateSamplesDuringMerge() {
|
|||
srcValues := b.values[b.nextIdx:]
|
||||
timestamps, values := deduplicateSamplesDuringMerge(srcTimestamps, srcValues, dedupInterval)
|
||||
dedups := len(srcTimestamps) - len(timestamps)
|
||||
atomic.AddUint64(&dedupsDuringMerge, uint64(dedups))
|
||||
dedupsDuringMerge.Add(uint64(dedups))
|
||||
b.timestamps = b.timestamps[:b.nextIdx+len(timestamps)]
|
||||
b.values = b.values[:b.nextIdx+len(values)]
|
||||
}
|
||||
|
||||
var dedupsDuringMerge uint64
|
||||
var dedupsDuringMerge atomic.Uint64
|
||||
|
||||
func (b *Block) rowsCount() int {
|
||||
if len(b.values) == 0 {
|
||||
|
|
|
@ -545,7 +545,7 @@ func (m *Metrics) Reset() {
|
|||
// UpdateMetrics updates m with metrics from s.
|
||||
func (s *Storage) UpdateMetrics(m *Metrics) {
|
||||
m.RowsAddedTotal = atomic.LoadUint64(&rowsAddedTotal)
|
||||
m.DedupsDuringMerge = atomic.LoadUint64(&dedupsDuringMerge)
|
||||
m.DedupsDuringMerge = dedupsDuringMerge.Load()
|
||||
m.SnapshotsCount += uint64(s.mustGetSnapshotsCount())
|
||||
|
||||
m.TooSmallTimestampRows += atomic.LoadUint64(&s.tooSmallTimestampRows)
|
||||
|
|
Loading…
Reference in a new issue