Skip to content

Commit

Permalink
Merge pull request #8792 from influxdata/sgc-13-backports
Browse files Browse the repository at this point in the history
Back port #8787
  • Loading branch information
stuartcarnie authored Sep 6, 2017
2 parents 1381c23 + 4af9665 commit b9cf183
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Bugfixes

- [#8770](https://github.com/influxdata/influxdb/pull/8770): Reduce how long it takes to walk the varrefs in an expression.
- [#8787](https://github.com/influxdata/influxdb/issues/8787): panic: runtime error: invalid memory address or nil pointer dereference.

## v1.3.5 [2017-08-29]

Expand Down
11 changes: 8 additions & 3 deletions tsdb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ type Shard struct {
path string
walPath string
id uint64
wg sync.WaitGroup

database string
retentionPolicy string
Expand Down Expand Up @@ -345,11 +344,10 @@ func (s *Shard) close(clean bool) error {
default:
close(s.closing)
}
s.wg.Wait()

if clean {
// Don't leak our shard ID and series keys in the index
s.UnloadIndex()
s.unloadIndex()
}

err := s.engine.Close()
Expand Down Expand Up @@ -398,6 +396,13 @@ func (s *Shard) LastModified() time.Time {

// UnloadIndex removes all references to this shard from the DatabaseIndex
func (s *Shard) UnloadIndex() {
if err := s.ready(); err != nil {
return
}
s.unloadIndex()
}

func (s *Shard) unloadIndex() {
s.index.RemoveShard(s.id)
}

Expand Down

0 comments on commit b9cf183

Please sign in to comment.