feat: Add error join for file writing in snapshots (#26004)

This PR adds an error join to help with handling multiple errors
from snapshot file writers.
pull/26022/head
WeblWabl 2025-02-12 15:06:43 -06:00 committed by GitHub
parent 306a184a8d
commit 4ad5e2aba7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -910,12 +910,12 @@ func (c *Compactor) WriteSnapshot(cache *Cache, logger *zap.Logger) ([]string, e
}(splits[i])
}
var err error
var errs []error
files := make([]string, 0, concurrency)
for i := 0; i < concurrency; i++ {
result := <-resC
if result.err != nil {
err = result.err
errs = append(errs, result.err)
}
files = append(files, result.files...)
}
@ -934,7 +934,7 @@ func (c *Compactor) WriteSnapshot(cache *Cache, logger *zap.Logger) ([]string, e
return nil, errSnapshotsDisabled
}
return files, err
return files, errors.Join(errs...)
}
// compact writes multiple smaller TSM files into 1 or more larger files.