Skip to content
Snippets Groups Projects
Commit 993f410a authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

vinyl: rework range compaction

Currently, compaction works as follows:
 1. worker: write old range's runs and shadow indexes to disk, creating
    as many new ranges as necessary (min 1)
 2. tx: redistribute active memory index of the old range among new
    ranges
 3. tx: replace old range with new ones and delete old one

Such a design has a serious drawback: redistribution (step #2) scales
lineary with the number of tuples and hence may take too long.

So this patch reworks the compact procedure. Now it looks like this:
 1. tx: create new ranges and insert them to the tree instead of the old
    range; in order not to break lookups, link mem and run of the old
    range to new ones
 2. worker: write mem and run of the old range to disk creating runs for
    each of new ranges
 3. tx: unlink old range's mem and run from new ranges and delete it

An old range is either split in two parts by the median key
(approximate) or not split at all, depending on its size.

Note, we don't split a range if it hasn't been compacted at least once.
This breaks assumptions of vinyl/split test, so I disable it for now. I
will rework it later, perhaps after sanitizing the scheduler.

Closes #1745
parent 6b11e6fd
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment