tsm1.DigestWithOptions closes its network connection
twice. This may cause broken pipe errors on concurrent
invocations of the same procedure, by closing a reused
i/o descriptor. This fix also captures errors from TSM
file closures, which were previously ignored.
Closes https://github.com/influxdata/influxdb/issues/21656
(cherry picked from commit bce6553459
)
Closes https://github.com/influxdata/influxdb/issues/21660
pull/21653/head^2
parent
23547fe746
commit
5251c85412
|
@ -31,6 +31,7 @@ This release adds an embedded SQLite database for storing metadata required by t
|
|||
|
||||
1. [21610](https://github.com/influxdata/influxdb/pull/21610): Avoid rewriting `fields.idx` unnecessarily.
|
||||
1. [21648](https://github.com/influxdata/influxdb/pull/21648): Change static legend's `hide` to `show` to let users decide if they want it.
|
||||
1. [21662](https://github.com/influxdata/influxdb/pull/21662): Do not close connection twice in DigestWithOptions
|
||||
|
||||
## v2.0.7 [2021-06-04]
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ type DigestOptions struct {
|
|||
|
||||
// DigestWithOptions writes a digest of dir to w using options to filter by
|
||||
// time and key range.
|
||||
func DigestWithOptions(dir string, files []string, opts DigestOptions, w io.WriteCloser) error {
|
||||
func DigestWithOptions(dir string, files []string, opts DigestOptions, w io.WriteCloser) (err error) {
|
||||
manifest, err := NewDigestManifest(dir, files)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -31,7 +31,9 @@ func DigestWithOptions(dir string, files []string, opts DigestOptions, w io.Writ
|
|||
tsmFiles := make([]TSMFile, 0, len(files))
|
||||
defer func() {
|
||||
for _, r := range tsmFiles {
|
||||
r.Close()
|
||||
if e := r.Close(); e != nil && err == nil {
|
||||
err = e
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -54,7 +56,11 @@ func DigestWithOptions(dir string, files []string, opts DigestOptions, w io.Writ
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dw.Close()
|
||||
defer func() {
|
||||
if e := dw.Close(); e != nil && err == nil {
|
||||
err = e
|
||||
}
|
||||
}()
|
||||
|
||||
// Write the manifest.
|
||||
if err := dw.WriteManifest(manifest); err != nil {
|
||||
|
@ -106,7 +112,7 @@ func DigestWithOptions(dir string, files []string, opts DigestOptions, w io.Writ
|
|||
return err
|
||||
}
|
||||
}
|
||||
return dw.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Digest writes a digest of dir to w of a full shard dir.
|
||||
|
|
Loading…
Reference in New Issue