Skip to content

Commit 37d21e8

Browse files
committed
Remove more unused code.
1 parent f063086 commit 37d21e8

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

ingester/ingester.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ func (i *Ingester) flushSeries(ctx context.Context, u *userState, fp model.Finge
477477
// Decide what chunks to flush
478478
if immediate || time.Now().Sub(series.head().FirstTime().Time()) > i.cfg.MaxChunkAge {
479479
series.headChunkClosed = true
480-
series.headChunkUsedByIterator = false
481480
series.head().MaybePopulateLastTime()
482481
}
483482
chunks := series.chunkDescs

ingester/series.go

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,14 @@ type memorySeries struct {
109109
// The timestamp of the last sample in this series. Needed to
110110
// ensure timestamp monotonicity during ingestion.
111111
lastTime model.Time
112-
// The last ingested sample value. Needed for fast access for
113-
// federation.
112+
// The value of the last sample in this series. Needed to
113+
// ensure timestamp monotonicity during ingestion.
114114
lastSampleValue model.SampleValue
115115
// Whether lastSampleValue has been set already.
116116
lastSampleValueSet bool
117117
// Whether the current head chunk has already been finished. If true,
118118
// the current head chunk must not be modified anymore.
119119
headChunkClosed bool
120-
// Whether the current head chunk is used by an iterator. In that case,
121-
// a non-closed head chunk has to be cloned before more samples are
122-
// appended.
123-
headChunkUsedByIterator bool
124120
}
125121

126122
// newMemorySeries returns a pointer to a newly allocated memorySeries for the
@@ -141,21 +137,6 @@ func (s *memorySeries) add(v model.SamplePair) (int, error) {
141137
newHead := chunk.NewDesc(chunk.New(), v.Timestamp)
142138
s.chunkDescs = append(s.chunkDescs, newHead)
143139
s.headChunkClosed = false
144-
} else if s.headChunkUsedByIterator && s.head().RefCount() > 1 {
145-
// We only need to clone the head chunk if the current head
146-
// chunk was used in an iterator at all and if the refCount is
147-
// still greater than the 1 we always have because the head
148-
// chunk is not yet persisted. The latter is just an
149-
// approximation. We will still clone unnecessarily if an older
150-
// iterator using a previous version of the head chunk is still
151-
// around and keep the head chunk pinned. We needed to track
152-
// pins by version of the head chunk, which is probably not
153-
// worth the effort.
154-
chunk.Ops.WithLabelValues(chunk.Clone).Inc()
155-
// No locking needed here because a non-persisted head chunk can
156-
// not get evicted concurrently.
157-
s.head().C = s.head().C.Clone()
158-
s.headChunkUsedByIterator = false
159140
}
160141

161142
chunks, err := s.head().Add(v)

0 commit comments

Comments
 (0)