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

Patches for 0.13.1 #6681

Closed
wants to merge 3 commits into from
Closed
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v0.13.1 [unreleased]

### Bugfixes

- [#6661](https://github.com/influxdata/influxdb/issues/6661): Disable limit optimization when using an aggregate.
- [#6627](https://github.com/influxdata/influxdb/pull/6627): Fix possible deadlock when queries and delete series run concurrently.
- [#6235](https://github.com/influxdata/influxdb/issues/6235): Fix measurement field panic in tsm1 engine.

## v0.13.0 [2016-05-12]

### Release Notes
Expand Down
21 changes: 10 additions & 11 deletions tsdb/engine/tsm1/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ func (e *Engine) CreateIterator(opt influxql.IteratorOptions) (influxql.Iterator
if call, ok := opt.Expr.(*influxql.Call); ok {
refOpt := opt
refOpt.Expr = call.Args[0].(*influxql.VarRef)
inputs, err := e.createVarRefIterator(refOpt)
inputs, err := e.createVarRefIterator(refOpt, true)
if err != nil {
return nil, err
}
Expand All @@ -758,7 +758,7 @@ func (e *Engine) CreateIterator(opt influxql.IteratorOptions) (influxql.Iterator
return nil, nil
}

itrs, err := e.createVarRefIterator(opt)
itrs, err := e.createVarRefIterator(opt, false)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -827,7 +827,9 @@ func (e *Engine) SeriesKeys(opt influxql.IteratorOptions) (influxql.SeriesList,
}

// createVarRefIterator creates an iterator for a variable reference.
func (e *Engine) createVarRefIterator(opt influxql.IteratorOptions) ([]influxql.Iterator, error) {
// The aggregate argument determines this is being created for an aggregate.
// If this is an aggregate, the limit optimization is disabled temporarily. See #6661.
func (e *Engine) createVarRefIterator(opt influxql.IteratorOptions, aggregate bool) ([]influxql.Iterator, error) {
ref, _ := opt.Expr.(*influxql.VarRef)

var itrs []influxql.Iterator
Expand Down Expand Up @@ -868,14 +870,8 @@ func (e *Engine) createVarRefIterator(opt influxql.IteratorOptions) ([]influxql.
inputs = append(inputs, input)
}

if len(inputs) > 0 && (opt.Limit > 0 || opt.Offset > 0) {
var itr influxql.Iterator
if opt.MergeSorted() {
itr = influxql.NewSortedMergeIterator(inputs, opt)
} else {
itr = influxql.NewMergeIterator(inputs, opt)
}
itrs = append(itrs, newLimitIterator(itr, opt))
if !aggregate && len(inputs) > 0 && (opt.Limit > 0 || opt.Offset > 0) {
itrs = append(itrs, newLimitIterator(influxql.NewSortedMergeIterator(inputs, opt), opt))
} else {
itrs = append(itrs, inputs...)
}
Expand Down Expand Up @@ -976,7 +972,10 @@ func (e *Engine) createVarRefSeriesIterator(ref *influxql.VarRef, mm *tsdb.Measu
// buildCursor creates an untyped cursor for a field.
func (e *Engine) buildCursor(measurement, seriesKey, field string, opt influxql.IteratorOptions) cursor {
// Look up fields for measurement.
e.mu.RLock()
mf := e.measurementFields[measurement]
e.mu.RUnlock()

if mf == nil {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions tsdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ func (s *Store) ExpandSources(sources influxql.Sources) (influxql.Sources, error

// IteratorCreators returns a set of all local shards as iterator creators.
func (s *Store) IteratorCreators() influxql.IteratorCreators {
s.mu.Lock()
defer s.mu.Unlock()
s.mu.RLock()
defer s.mu.RUnlock()

a := make(influxql.IteratorCreators, 0, len(s.shards))
for _, sh := range s.shards {
Expand Down