Fix mmap dereferencing
Adds a missing dereference call to `Close()` as well as fixes a tag copy issue.pull/7196/head
parent
a2fcafd5c0
commit
cc628a1097
|
@ -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]
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue