cockroachdb / pebble

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

db: consider reworking rangedel, megingIter and levelIter interactions #2863

Open jbowens opened 1 year ago

jbowens commented 1 year ago

Currently, there's an intricate coordination dance performed between mergingIter and levelIter in order to make range deletions work. This dance has several complexities that make it fragile and difficult to grok. The introduction of range-key masking and "truthful" block-property filters also forces us into some awkward contortions to deal with the fact that a file's point iterator and range deletion iterator may become exhausted at different times.

I suspect we could significantly clean things up by using the keyspan.InterleavingIter within the levelIter implementation. It would work something like:

The memtable and indexed batch levels will also have to be adjusted to make use of a keyspan.InterleavingIter.

Jira issue: PEBBLE-82

jbowens commented 1 year ago

cc @sumeerbhola