diff --git a/tsdb/head.go b/tsdb/head.go index 477ca9fe2..c520ddbc4 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -2120,8 +2120,7 @@ func (s sample) Type() chunkenc.ValueType { // memSeries is the in-memory representation of a series. None of its methods // are goroutine safe and it is the caller's responsibility to lock it. type memSeries struct { - sync.Mutex - + // Members up to the Mutex are not changed after construction, so can be accessed without a lock. ref chunks.HeadSeriesRef lset labels.Labels meta *metadata.Metadata @@ -2133,6 +2132,10 @@ type memSeries struct { // Value returned by secondary hash function. secondaryHash uint32 + sync.Mutex + + // Everything after here should only be accessed with the lock. + // Immutable chunks on disk that have not yet gone into a block, in order of ascending time stamps. // When compaction runs, chunks get moved into a block and all pointers are shifted like so: //