Commit Graph

8 Commits (624a92a0a67bc6c654ab5f51698667cbd8a379e0)

Author SHA1 Message Date
Edd Robinson 19a36e0dc7 Remove copy-on-write when caching bitmaps
In the case of caching TSI bitmaps belonging to immutable .tsi files,
the underlying bitset data can be mmapped. It is possible, though rare,
for this data to be unmapped (e.g., via a TSI compaction) but for the
cached bitmap to be subsequently read. This leads to a segfault.

This only happens when copy-on-write is set to true on the roaring
bitmap, because in that case only the internal pointers are cloned.

This change will reduce the TSI cache performance by around 10%, which I
have deemed to account for only a few microseconds typically.
2019-01-25 13:38:22 +00:00
Edd Robinson 7ee4f499e1 Clarify best method of set difference 2019-01-14 12:46:53 +00:00
Mark Rushakoff 1ab9c80ae8 fix(tsdb): eliminate data race from *SeriesIDSet.Clone
And add a test to cover that.

The data race would look roughly like:

```
WARNING: DATA RACE
Write at 0x00c000024e18 by goroutine 8:
  github.com/RoaringBitmap/roaring.(*roaringArray).markAllAsNeedingCopyOnWrite()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaringarray.go:881 +0x6b
  github.com/RoaringBitmap/roaring.(*roaringArray).clone()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaringarray.go:266 +0x808
  github.com/RoaringBitmap/roaring.(*Bitmap).Clone()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaring.go:385 +0x58
  github.com/influxdata/platform/tsdb.(*SeriesIDSet).CloneNoLock()
      /Users/mr/go/src/github.com/influxdata/platform/tsdb/series_set.go:229 +0x73
  github.com/influxdata/platform/tsdb.(*SeriesIDSet).Clone()

Previous write at 0x00c000024e18 by goroutine 7:
  github.com/RoaringBitmap/roaring.(*roaringArray).markAllAsNeedingCopyOnWrite()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaringarray.go:881 +0x6b
  github.com/RoaringBitmap/roaring.(*roaringArray).clone()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaringarray.go:266 +0x808
  github.com/RoaringBitmap/roaring.(*Bitmap).Clone()
      /Users/mr/go/pkg/mod/github.com/!roaring!bitmap/roaring@v0.4.16/roaring.go:385 +0x58
  github.com/influxdata/platform/tsdb.(*SeriesIDSet).CloneNoLock()
      /Users/mr/go/src/github.com/influxdata/platform/tsdb/series_set.go:229 +0x73
  github.com/influxdata/platform/tsdb.(*SeriesIDSet).Clone()
      /Users/mr/go/src/github.com/influxdata/platform/tsdb/series_set.go:223 +0x7b
```
2018-11-13 08:12:38 -08:00
Edd Robinson ed81da6600 Update roaring dependency 2018-10-01 12:08:37 +01:00
Edd Robinson 3385f389f7 Update tsdb package from OSS 2018-10-01 12:08:37 +01:00
Edd Robinson 074f263e08 Initial import of tsm1.Engine 2018-10-01 12:08:37 +01:00
Jeff Wendling d44b583c4d remove code as reported by the unused tool 2018-10-01 12:03:19 +01:00
Jeff Wendling 992884ab6c initial import of tsdb package 2018-10-01 12:03:19 +01:00