tsdb/wal: Move comment of w.writer.Append(...) to the WriteTo interface (#10198)

Signed-off-by: wanglipeng <wanglipeng@huayun.com>

Co-authored-by: wanglipeng <wanglipeng@huayun.com>
This commit is contained in:
lwangrabbit 2022-01-31 14:14:16 +08:00 committed by GitHub
parent 500cfd0b6f
commit 9fde6edbf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -45,9 +45,14 @@ const (
// from the WAL on to somewhere else. Functions will be called concurrently // 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. // and it is left to the implementer to make sure they are safe.
type WriteTo interface { 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 Append([]record.RefSample) bool
AppendExemplars([]record.RefExemplar) bool AppendExemplars([]record.RefExemplar) bool
StoreSeries([]record.RefSeries, int) StoreSeries([]record.RefSeries, int)
// Next two methods are intended for garbage-collection: first we call // Next two methods are intended for garbage-collection: first we call
// UpdateSeriesSegment on all current series // UpdateSeriesSegment on all current series
UpdateSeriesSegment([]record.RefSeries, int) UpdateSeriesSegment([]record.RefSeries, int)
@ -511,7 +516,6 @@ func (w *Watcher) readSegment(r *LiveReader, segmentNum int, tail bool) error {
} }
} }
if len(send) > 0 { if len(send) > 0 {
// Blocks until the sample is sent to all remote write endpoints or closed (because enqueue blocks).
w.writer.Append(send) w.writer.Append(send)
send = send[:0] send = send[:0]
} }