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
parent
306a184a8d
commit
4ad5e2aba7
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue