cockroachdb / pebble

RocksDB/LevelDB inspired key-value database in Go
BSD 3-Clause "New" or "Revised" License
4.8k stars 447 forks source link

sstable: fix double close of fragmentBlockIter #3672

Closed RaduBerinde closed 3 months ago

RaduBerinde commented 3 months ago

This change addresses a TODO to fix double closing of the fragmentBlockIter. We can now use a sync.Pool and we can remove the wrapper type that used a sync pool only for range key iterators.

We add an invariants.DoubleCloseCheck type which checks for multiple close calls in invariant builds. In these builds we sometimes don't put objects back in the pool, so that this check can run.

We now always call fragmentBlockIter.init() (we were missing on a minor optimization before).

cockroach-teamcity commented 3 months ago

This change is Reviewable