Align int64s for atomic operations

This commit is contained in:
Fabian Reinartz 2015-05-21 01:37:04 +02:00
parent d4bd3397ae
commit 112a778922
2 changed files with 10 additions and 7 deletions

View File

@ -23,12 +23,14 @@ type fpMappings map[clientmodel.Fingerprint]map[string]clientmodel.Fingerprint
// fpMapper is used to map fingerprints in order to work around fingerprint
// collisions.
type fpMapper struct {
// highestMappedFP has to be aligned for atomic operations.
highestMappedFP clientmodel.Fingerprint
mtx sync.RWMutex // Protects mappings.
mappings fpMappings
fpToSeries *seriesMap
p *persistence
highestMappedFP clientmodel.Fingerprint
fpToSeries *seriesMap
p *persistence
}
// newFPMapper loads the collision map from the persistence and

View File

@ -79,6 +79,11 @@ const (
type syncStrategy func() bool
type memorySeriesStorage struct {
// numChunksToPersist has to be aligned for atomic operations.
numChunksToPersist int64 // The number of chunks waiting for persistence.
maxChunksToPersist int // If numChunksToPersist reaches this threshold, ingestion will stall.
degraded bool
fpLocker *fingerprintLocker
fpToSeries *seriesMap
@ -90,10 +95,6 @@ type memorySeriesStorage struct {
checkpointInterval time.Duration
checkpointDirtySeriesLimit int
numChunksToPersist int64 // The number of chunks waiting for persistence.
maxChunksToPersist int // If numChunksToPersist reaches this threshold, ingestion will stall.
degraded bool
persistence *persistence
mapper *fpMapper