Use an RW lock to checkpoint fingerprint mappings.
This has to be backported to 0.13.x.
This commit is contained in:
parent
acd2df7507
commit
dbcb3d9333
|
@ -141,10 +141,10 @@ func (m *fpMapper) maybeAddMapping(
|
||||||
// A new mapping has to be created.
|
// A new mapping has to be created.
|
||||||
mappedFP = m.nextMappedFP()
|
mappedFP = m.nextMappedFP()
|
||||||
mappedFPs[ms] = mappedFP
|
mappedFPs[ms] = mappedFP
|
||||||
m.mtx.RLock()
|
m.mtx.Lock()
|
||||||
// Checkpoint mappings after each change.
|
// Checkpoint mappings after each change.
|
||||||
err := m.p.checkpointFPMappings(m.mappings)
|
err := m.p.checkpointFPMappings(m.mappings)
|
||||||
m.mtx.RUnlock()
|
m.mtx.Unlock()
|
||||||
log.Infof(
|
log.Infof(
|
||||||
"Collision detected for fingerprint %v, metric %v, mapping to new fingerprint %v.",
|
"Collision detected for fingerprint %v, metric %v, mapping to new fingerprint %v.",
|
||||||
fp, collidingMetric, mappedFP,
|
fp, collidingMetric, mappedFP,
|
||||||
|
|
Loading…
Reference in New Issue