Fix data races in WAL replay (#10571)

Signed-off-by: chavacava <salvadorcavadini+github@gmail.com>
This commit is contained in:
chavacava 2022-04-12 12:30:20 +02:00 committed by GitHub
parent ce6a643ee8
commit 0b41fd6e71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -410,6 +410,7 @@ func (db *DB) loadWAL(r *wal.Reader, multiRef map[chunks.HeadSeriesRef]chunks.He
go func() { go func() {
defer close(decoded) defer close(decoded)
var err error
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()
switch dec.Type(rec) { switch dec.Type(rec) {

View file

@ -133,6 +133,7 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[chunks.HeadSeriesRef]chunks.H
go func() { go func() {
defer close(decoded) defer close(decoded)
var err error
for r.Next() { for r.Next() {
rec := r.Record() rec := r.Record()
switch dec.Type(rec) { switch dec.Type(rec) {