Fix mmap dereferencing

Adds a missing dereference call to `Close()` as well as fixes
a tag copy issue.
pull/7196/head
Ben Johnson 2016-08-23 16:04:22 -06:00
parent a2fcafd5c0
commit cc628a1097
No known key found for this signature in database
GPG Key ID: 81741CD251883081
4 changed files with 10 additions and 6 deletions

View File

@ -16,6 +16,7 @@
- [#1834](https://github.com/influxdata/influxdb/issues/1834): Drop time when used as a tag or field key. - [#1834](https://github.com/influxdata/influxdb/issues/1834): Drop time when used as a tag or field key.
- [#7152](https://github.com/influxdata/influxdb/issues/7152): Decrement number of measurements only once when deleting the last series from a measurement. - [#7152](https://github.com/influxdata/influxdb/issues/7152): Decrement number of measurements only once when deleting the last series from a measurement.
- [#7177](https://github.com/influxdata/influxdb/issues/7177): Fix base64 encoding issue with /debug/vars stats. - [#7177](https://github.com/influxdata/influxdb/issues/7177): Fix base64 encoding issue with /debug/vars stats.
- [#7196](https://github.com/influxdata/influxdb/ssues/7196): Fix mmap dereferencing, fixes #7183, #7180
## v1.0.0 [unreleased] ## v1.0.0 [unreleased]

View File

@ -442,8 +442,11 @@ func (f *FileStore) Close() error {
f.mu.Lock() f.mu.Lock()
defer f.mu.Unlock() defer f.mu.Unlock()
for _, f := range f.files { for _, file := range f.files {
f.Close() if f.dereferencer != nil {
file.deref(f.dereferencer)
}
file.Close()
} }
f.files = nil f.files = nil

View File

@ -491,7 +491,7 @@ func (t *TSMReader) BlockIterator() *BlockIterator {
// deref removes mmap references held by another object. // deref removes mmap references held by another object.
func (t *TSMReader) deref(d dereferencer) { func (t *TSMReader) deref(d dereferencer) {
if acc, ok := t.accessor.(*mmapAccessor); ok { if acc, ok := t.accessor.(*mmapAccessor); ok && acc.b != nil {
d.Dereference(acc.b) d.Dereference(acc.b)
} }
} }

View File

@ -1504,9 +1504,9 @@ func (s *Series) Dereference(b []byte) {
min := uintptr(unsafe.Pointer(&b[0])) min := uintptr(unsafe.Pointer(&b[0]))
max := min + uintptr(len(b)) max := min + uintptr(len(b))
for _, t := range s.Tags { for i := range s.Tags {
deref(&t.Key, min, max) deref(&s.Tags[i].Key, min, max)
deref(&t.Value, min, max) deref(&s.Tags[i].Value, min, max)
} }
s.mu.Unlock() s.mu.Unlock()