> **SUPERSEDED (2026-11-12)** by `2026-11-12-cfs-direct-port-from-qdbpg` > (direct code port from qdbpg replaces the clean-room phases). Task list > frozen as-is; remaining items are subsumed by the port. ## Adoption and pre-implementation - [ ] Plan owner folds binding amendments 1-6 into Confluence page 467513822 - [ ] ADR: recovery-time CFS selector (sidecar presence vs WAL-carried flag) — blocks Phase 6; options and preference recorded in doc/src/sgml/cfs.sgml (ADR-CFS-1), decision pending - [x] Build profile updated: `--with-lz4 --with-zstd` added to full_build.sh CONFIG_OPTS and README_BUILD.txt profile (validated: configure + cfs module + src/common compile in a --with-lz4 --with-zstd out-of-tree build); packaging deps for distr/ASTRA, distr/UBUNTU, distr/ALT still pending ## MVP (per Confluence plan + amendment 4) Phase 0 — scaffold (A0.1-A0.3) - [x] Constants/enums/ABI header (`src/include/storage/cfs.h`), `src/backend/storage/cfs/` in build (Makefile + meson), ADR in `doc/src/sgml/cfs.sgml`; CORE_CHANGES.md entry `[PG_CUSTOM: CFS]` Phase 1 — codec (A1.1-A1.5) - [x] `cfs_codec` dispatch API (`src/include/storage/cfs_codec.h` + `cfs_codec.c`): availability, names, SQL-level parser, bound, compress/decompress with INCOMPRESSIBLE/UNSUPPORTED semantics - [x] CRC32C helpers with metadata/payload domain separation (`cfs_crc32c_header/_payload`) - [x] RAW internal representation (incompressible fallback) - [x] LZ4/ZSTD binding stubs with owner handoff contract (`cfs_codec_lz4.c`/`cfs_codec_zstd.c`, report unavailable; real algorithms owned by codec implementer) - [x] SQL round-trip test module `cfs_test` (`src/test/modules/cfs_test`): availability, raw roundtrips, corrupt-CRC detection, unavailable-algorithm NOTICE path, invalid-name rejection; regression green - [ ] LZ4 and ZSTD bindings implemented by codec owner + test cases/expected extended for real algorithms Phase 2 — on-disk format (A2.1-A2.5) - [ ] Structs with version + CRC, `CfsFormatStatus` validation, path helpers, fsck (entries <= 24 bytes per working default) Phase 3 — storage layer (A3.1-A3.8, incl. amendment 4) - [ ] Sidecar open/create, block read/write, append-only writes - [ ] Journal update + in-memory map, idempotent replay, truncated-tail handling - [ ] Compaction primitives (temp set, copy, fsync, atomic swap) - [ ] `CfsStorageOps` vtable + `cfs_init_ops()` Phase 4 — shmem (A4.1-A4.4) - [ ] Partitioned map cache (LRU hot-subset default) + LWLocks + stats + invalidation/eviction Phase 5 — SQL policy (A5.1-A5.4) - [ ] Reloptions `algorithm/level/min_gain_bytes` with validation (TEMP/UNLOGGED rejected), GUC defaults, `RelationUsesCfs()`/`RelFileLocatorUsesCfs()` + locator cache and invalidation, inheritance rules Phase 6 — smgr integration (A6.1-A6.5, gated on the selector ADR) - [ ] `cfs_state[]/cfs_enabled[]` in `SMgrRelationData`, sidecar create/unlink lifecycle, logical nblocks/truncate/zeroextend (invalid-zero sentinel), dispatch in `smgrreadv/writev` via `cfs_ops` Phase 7 — buffer manager (A7.1-A7.5) - [ ] Read miss decompress / dirty flush compress, extension and zero pages, checksums preserved - [ ] MVP sync read: `smgrmaxcombine()=1`, `smgrstartreadv()` -> `pgaio_io_complete_readv_immediate()` - [ ] kill -9 TAP harness running from this phase (pulled forward from Phase 9) Phase 8 — checkpoint (A8.1-A8.3) - [ ] CFS FileTag kind + `cfs_register_dirty_file/sync/unlink`, checkpoint order `.cfp -> .cfsjrn -> .cfsmap`, restartpoints Phase 9 — recovery (A9.1-A9.3) - [ ] Startup journal replay before accepting connections; recovery-time selector per ADR; crash matrix green ## Post-MVP Phase 8+ (A8.4-A8.5) - [ ] `CfsBgWorker` compactor + GUCs, skip during base backup (amendment 2) Phase 9+ (A9.4-A9.6) - [ ] Streaming replication / standby, PITR, `cfs.checksum_failure` / `cfs.recovery_strict` Phase 10 (A10.1-A10.7, A10.4a) - [ ] DDL lifecycle: rewrite/rebuild paths, TOAST, UNLOGGED/TEMP ban, plain VACUUM no compaction, `ALTER INDEX` requires REINDEX Phase 11 (A11.1-A11.4) - [ ] `pg_cfs_*` functions, `pg_stat_cfs`, `pg_cfs_settings`, wait events Phase 12 (A12.1-A12.7, incl. amendment 3) - [ ] Size functions (physical default), basebackup/verifybackup manifest, pg_checksums skip by suffix, pg_upgrade version gate, pageinspect/amcheck/pgstattuple, pg_rewind decision Phase 13 (A13.1-A13.4) - [ ] pgbench profiles, compression-ratio and overhead reports, crash-recovery timing, soak matrix (io_method=sync/worker/io_uring) Phase 14 (A14.1-A14.3) - [ ] Admin guide, developer guide, runbook ## Deferred track - [ ] Async AIO per-record reads with decompression callback under amendment 5 constraints - [ ] Archive this OpenSpec when the feature ships