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: return MergeIterator.Close errors (#24975) (#24997) #24998

Merged
merged 1 commit into from
May 14, 2024
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
26 changes: 16 additions & 10 deletions influxql/query/iterator.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package query
import (
"container/heap"
"context"
"errors"
"io"
"sort"
"sync"
Expand Down Expand Up @@ -162,14 +163,15 @@ func (itr *floatMergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down Expand Up @@ -2825,14 +2827,15 @@ func (itr *integerMergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down Expand Up @@ -5488,14 +5491,15 @@ func (itr *unsignedMergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down Expand Up @@ -8151,14 +8155,15 @@ func (itr *stringMergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down Expand Up @@ -10800,14 +10805,15 @@ func (itr *booleanMergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down
6 changes: 4 additions & 2 deletions influxql/query/iterator.gen.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package query
import (
"context"
"container/heap"
"errors"
"io"
"sort"
"sync"
Expand Down Expand Up @@ -159,14 +160,15 @@ func (itr *{{$k.name}}MergeIterator) Close() error {
itr.mu.Lock()
defer itr.mu.Unlock()

var errs []error
for _, input := range itr.inputs {
input.Close()
errs = append(errs, input.Close())
}
itr.curr = nil
itr.inputs = nil
itr.heap.items = nil
itr.closed = true
return nil
return errors.Join(errs...)
}

// Next returns the next point from the iterator.
Expand Down