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

fix: do not panic on cleaning up failed iterators #21666

Merged
merged 3 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
v1.9.3 [unreleased]

#### Bugfixes

- [#21592](https://github.com/influxdata/influxdb/pull/21592): fix: avoid rewriting fields.idx unnecessarily
- [#21659](https://github.com/influxdata/influxdb/pull/21659): fix: do not close connection twice in DigestWithOptions
- [#21666](https://github.com/influxdata/influxdb/pull/21666): fix: do not panic on cleaning up failed iterators

v1.9.2 [unreleased]
- [#21631](https://github.com/influxdata/influxdb/pull/21631): fix: group by returns multiple results per group in some circumstances
Expand Down
17 changes: 14 additions & 3 deletions query/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,22 @@ func (a Iterators) Stats() IteratorStats {
}

// Close closes all iterators.
func (a Iterators) Close() error {
// We are seeing an occasional panic in this function
// which looks like a nil reference from one
// itr.Close() call, thus we check for nil elements
// in the slice a. This is often called as error
// clean-up, so the state of the iterators may be
// unhappy.
func (a Iterators) Close() (err error) {
err = nil
for _, itr := range a {
itr.Close()
if itr != nil {
if e := itr.Close(); e != nil && err == nil {
err = e
}
}
}
return nil
return err
}

// filterNonNil returns a slice of iterators that removes all nil iterators.
Expand Down