pull/8716/head
Stuart Carnie 2017-08-17 15:47:47 -07:00
parent 4233763321
commit 25edd7bfdf
2 changed files with 7 additions and 6 deletions

View File

@ -1563,7 +1563,7 @@ func (e *Engine) CreateIterator(measurement string, opt query.IteratorOptions) (
if err != nil {
return nil, err
}
return newMergeGuardIterator(itrs, opt)
return newMergeFinalizerIterator(itrs, opt)
}
}
@ -1573,14 +1573,14 @@ func (e *Engine) CreateIterator(measurement string, opt query.IteratorOptions) (
} else if len(inputs) == 0 {
return nil, nil
}
return newMergeGuardIterator(inputs, opt)
return newMergeFinalizerIterator(inputs, opt)
}
itrs, err := e.createVarRefIterator(measurement, opt)
if err != nil {
return nil, err
}
return newMergeGuardIterator(itrs, opt)
return newMergeFinalizerIterator(itrs, opt)
}
func (e *Engine) createCallIterator(measurement string, call *influxql.Call, opt query.IteratorOptions) ([]query.Iterator, error) {

View File

@ -149,9 +149,10 @@ func (c cursorsAt) close() {
}
}
// newMergeGuardIterator creates a new Merge iterator from the inputs. If Merge returns an error,
// the inputs will be closed
func newMergeGuardIterator(inputs []query.Iterator, opt query.IteratorOptions) (query.Iterator, error) {
// newMergeFinalizerIterator creates a new Merge iterator from the inputs. If the call to Merge succeeds,
// the resulting Iterator will be wrapped in a finalizer iterator.
// If Merge returns an error, the inputs will be closed.
func newMergeFinalizerIterator(inputs []query.Iterator, opt query.IteratorOptions) (query.Iterator, error) {
itr, err := query.Iterators(inputs).Merge(opt)
if err != nil {
query.Iterators(inputs).Close()