Skip to content

Commit ee9aeb6

Browse files
grobinson-grafanabenclive
authored andcommitted
fix: add missing flush op timeout (grafana#13679)
1 parent 57d2199 commit ee9aeb6

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/sources/shared/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ ingester_rf1:
358358
# The timeout for an individual flush. Will be retried up to
359359
# `flush-op-backoff-retries` times.
360360
# CLI flag: -ingester-rf1.flush-op-timeout
361-
[flush_op_timeout: <duration> | default = 10m]
361+
[flush_op_timeout: <duration> | default = 10s]
362362

363363
# Forget about ingesters having heartbeat timestamps older than
364364
# `ring.kvstore.heartbeat_timeout`. This is equivalent to clicking on the

pkg/ingester-rf1/flush.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ func (i *Ingester) flush(l log.Logger, j int, it *wal.PendingSegment) error {
9696
}
9797

9898
func (i *Ingester) flushSegment(ctx context.Context, j int, w *wal.SegmentWriter) error {
99-
start := time.Now()
99+
ctx, cancelFunc := context.WithTimeout(ctx, i.cfg.FlushOpTimeout)
100+
defer cancelFunc()
100101

102+
start := time.Now()
101103
i.metrics.flushesTotal.Add(1)
102104
defer func() { i.metrics.flushDuration.Observe(time.Since(start).Seconds()) }()
103105

pkg/ingester-rf1/ingester.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
110110
f.DurationVar(&cfg.FlushOpBackoff.MinBackoff, "ingester-rf1.flush-op-backoff-min-period", 100*time.Millisecond, "Minimum backoff period when a flush fails. Each concurrent flush has its own backoff, see `ingester.concurrent-flushes`.")
111111
f.DurationVar(&cfg.FlushOpBackoff.MaxBackoff, "ingester-rf1.flush-op-backoff-max-period", time.Minute, "Maximum backoff period when a flush fails. Each concurrent flush has its own backoff, see `ingester.concurrent-flushes`.")
112112
f.IntVar(&cfg.FlushOpBackoff.MaxRetries, "ingester-rf1.flush-op-backoff-retries", 10, "Maximum retries for failed flushes.")
113-
f.DurationVar(&cfg.FlushOpTimeout, "ingester-rf1.flush-op-timeout", 10*time.Minute, "The timeout for an individual flush. Will be retried up to `flush-op-backoff-retries` times.")
113+
f.DurationVar(&cfg.FlushOpTimeout, "ingester-rf1.flush-op-timeout", 10*time.Second, "The timeout for an individual flush. Will be retried up to `flush-op-backoff-retries` times.")
114114
f.DurationVar(&cfg.MaxSegmentAge, "ingester-rf1.max-segment-age", 500*time.Millisecond, "The maximum age of a segment before it should be flushed. Increasing this value allows more time for a segment to grow to max-segment-size, but may increase latency if the write volume is too small.")
115115
f.IntVar(&cfg.MaxSegmentSize, "ingester-rf1.max-segment-size", 8*1024*1024, "The maximum size of a segment before it should be flushed. It is not a strict limit, and segments can exceed the maximum size when individual appends are larger than the remaining capacity.")
116116
f.IntVar(&cfg.MaxSegments, "ingester-rf1.max-segments", 10, "The maximum number of segments to buffer in-memory. Increasing this value allows for large bursts of writes to be buffered in memory, but may increase latency if the write volume exceeds the rate at which segments can be flushed.")

0 commit comments

Comments
 (0)