Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add error joins/returns (#25996) #26000

Open
wants to merge 1 commit into
base: main-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tsdb/engine/tsm1/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,16 +1101,25 @@ func (c *Compactor) writeNewFiles(generation, sequence int, src []string, iter K
}
return nil, err
} else if err != nil {
var errs []error
errs = append(errs, err)
// We hit an error and didn't finish the compaction. Abort.
// Remove any tmp files we already completed
// discard later errors to return the first one from the write() call
for _, f := range files {
_ = os.RemoveAll(f)
err = os.RemoveAll(f)
if err != nil {
errs = append(errs, err)
}
}
// Remove the temp file
// discard later errors to return the first one from the write() call
_ = os.RemoveAll(fileName)
return nil, err
err = os.RemoveAll(fileName)
if err != nil {
errs = append(errs, err)
}

return nil, errors.Join(errs...)
}

files = append(files, fileName)
Expand Down