neondatabase / neon

Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, code-like database branching, and scale to zero.
https://neon.tech
Apache License 2.0
14.75k stars 428 forks source link

Epic: Pageserver Timeline Archival #8088

Open jcsp opened 4 months ago

jcsp commented 4 months ago

Purpose

Enable users to create branches fearlessly, without worrying about hitting branch count limits & without having to worry about cleaning up old branches unless they want to.

Background

Currently, all timelines have significant physical overhead on the pageserver, even if they haven't been used for days/weeks/months:

Changes

This section isn't an authoritative design, but calls out functional areas that will need work.

### Tasks
- [ ] https://github.com/neondatabase/neon/issues/8218
- [ ] https://github.com/neondatabase/neon/pull/8131
- [ ] https://github.com/neondatabase/neon/pull/8414
- [ ] https://github.com/neondatabase/neon/pull/8458
- [x] https://github.com/neondatabase/neon/issues/8459 / https://github.com/neondatabase/neon/pull/8479
- [x] pageserver: implement visible layer housekeeping, for use in warm-ups
- [ ] https://github.com/neondatabase/neon/pull/8824
- [x] controller: add pass-through for `archival_config` API: #8680
- [ ] https://github.com/neondatabase/neon/pull/9122
- [ ] https://github.com/neondatabase/neon/pull/8907
- [ ] #9289
- [ ] https://github.com/neondatabase/neon/pull/9308
- [ ] https://github.com/neondatabase/neon/pull/9399
- [ ] https://github.com/neondatabase/neon/issues/9384
- [ ] #9421
- [ ] https://github.com/neondatabase/neon/issues/9386
- [ ] offloaded timeline query API
- [ ] audit code to ensure that gc_info children being removed on offload is fine
- [ ] test retain_lsn functionality for offloaded branches
- [ ] test for deletion of offloaded timeline
- [ ] test for many timelines depending on each other
- [ ] test that offloaded timelines are excluded from heatmaps and never downloaded to secondaries
- [ ] pytest for archival/unarchival together with storage controller and old generations
- [ ] controller: ensure that timeline passthrough operations (incl. archival) land on shards with the latest generation (check generation is still current after they ack)
- [ ] --- Milestone: archived branches are cheap locally -- (no index load on startup, no layers on disk, no Timeline at runtime)
- [ ] pageserver: implement warm-up API
- [ ] tests: after warming up, a read workload should not result in any on-demand downloads
- [ ] pageserver: expose billing metrics for active size vs. archived size
- [ ] add timeline flattening (including some way to block offload for it)
- [ ] --- Milestone: archived branches are cheap in remote storage -- eventually written as compressed image layers at a single LSN
- [ ] make scrubber check S3 invariants: a) timeline that is offloaded must be archived, b) timeline that is archived must have all of its children archived as well
- [ ] unified lock for offloaded/timelines/loading timelines: eliminates some race conditions and inconsistent states
- [ ] test: offload but pageserver crashes somewhere in delete_local_timeline_directory: can the pageserver deal with remnants after a restart?
arpad-m commented 2 months ago

This week:

arpad-m commented 2 months ago

This week:

arpad-m commented 1 week ago

This week:

arpad-m commented 4 days ago

This week: