From 9fde6edbf562a04c1b5b85b71c5b2613e3257833 Mon Sep 17 00:00:00 2001 From: lwangrabbit Date: Mon, 31 Jan 2022 14:14:16 +0800 Subject: [PATCH] tsdb/wal: Move comment of w.writer.Append(...) to the WriteTo interface (#10198) Signed-off-by: wanglipeng Co-authored-by: wanglipeng --- tsdb/wal/watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tsdb/wal/watcher.go b/tsdb/wal/watcher.go index 3c47b58d0..2c80e676f 100644 --- a/tsdb/wal/watcher.go +++ b/tsdb/wal/watcher.go @@ -45,9 +45,14 @@ const ( // from the WAL on to somewhere else. Functions will be called concurrently // and it is left to the implementer to make sure they are safe. type WriteTo interface { + // Append and AppendExemplar should block until the samples are fully accepted, + // whether enqueued in memory or successfully written to it's final destination. + // Once returned, the WAL Watcher will not attempt to pass that data again. Append([]record.RefSample) bool AppendExemplars([]record.RefExemplar) bool + StoreSeries([]record.RefSeries, int) + // Next two methods are intended for garbage-collection: first we call // UpdateSeriesSegment on all current series UpdateSeriesSegment([]record.RefSeries, int) @@ -511,7 +516,6 @@ func (w *Watcher) readSegment(r *LiveReader, segmentNum int, tail bool) error { } } if len(send) > 0 { - // Blocks until the sample is sent to all remote write endpoints or closed (because enqueue blocks). w.writer.Append(send) send = send[:0] }