materialize
materialize copied to clipboard
persist: spin off separate compaction worker per shard
With bounded memory compaction, we can now be assured that a single compaction operation does not exceed a particular amount of memory. However! It's still possible for compaction operations of a single process to overlap one another, especially when compacting many batches at once, which means that we can't yet guarantee a particular memory usage for a given shard.
Similar to https://github.com/MaterializeInc/materialize/pull/14064, this PR spins out a separate background compaction worker per shard, each ensuring only 1 compaction request is executed at a time. To keep things simple at the start, no effort to merge compaction requests is made. A new metric compaction.requested
has been added that will help give visibility into whether we're accumulating a backlog of compaction reqs or not.
Motivation
Tips for reviewer
Checklist
-
[ ] This PR has adequate test coverage / QA involvement has been duly considered.
-
[ ] This PR evolves an existing
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way) and therefore is tagged with aT-protobuf
label. -
[ ] This PR includes the following user-facing behavior changes: