docs/rfcs/012-background-tasks.md
Write out in-memory layer to disk, into a delta layer.
To release memory
To make it possible to advance disk_consistent_lsn and allow the WAL service to release some WAL.
Triggered if we are short on memory
Or if the oldest in-memory layer is so old that it's holding back the WAL service from removing old WAL
Create a new image layer of a segment, by performing WAL redo
To reduce the amount of WAL that needs to be replayed on a GetPage request.
To allow garbage collection of old layers
Triggered by distance to last full image of a page
Replace N consecutive layers of a segment with one larger layer.
Zip together multiple small files belonging to different segments.
Remove a layer that's older than the GC horizon, and isn't needed anymore.