Repository navigation
p4: lean phase-3 GC authority (final) - #73
Merged
Merged
Conversation
This was referenced Nov 23, 2026
mengmengmengqiang
added a commit
that referenced
this pull request
Nov 23, 2026
The tree of this commit is exactly the export of LayerFS p4-integration at 123e2825d3108687660882011f6b71f34e36bbdb549a6b62b6b61bb955526766ae (code 12f5785a511cb79064885c9bda5a3033e7f5a8bc5f049a0bb06d5b1aede7a17cc5 plus the phase-3 audit docs). The parent is layerfs_v2_0_0 (ed91189), the PR #73 base, so the PR diff is the whole p4 tree against the release. This replaces the previous p4-lean-phase3 head (ba4469d), a lossy merge of p4 into main that dropped p4 code: the store.call place_view carry, api/crates/layerfs-api/src/store/repair_mount_holders.rs, the p4 postgresql home, and more. Raw p4: no p4-on-release post-merge adaptations are included. In particular the p4 gc_intent_release_done.sql has no `AND state <> 'done'` guard (that guard was added on p4-on-release, not in p4).
mengmengmengqiang
force-pushed
the
p4-lean-phase3
branch
from
November 23, 2026 20:15
ba4469d to
fb4eaa6
Compare
mengmengmengqiang
force-pushed
the
p4-lean-phase3
branch
2 times, most recently
from
November 23, 2026 21:13
73a89f2 to
337336b
Compare
mengmengmengqiang
force-pushed
the
p4-lean-phase3
branch
from
November 23, 2026 21:32
337336b to
8cf5694
Compare
`the_converted_store_serves_the_operator_audit` was spliced into the body of `the_converted_store_opens_and_the_home_holds_the_old_authority`: that test's PRAGMA, dropped-table and sequence assertions and its closing brace sat after the second test, so the second `#[test]` was nested in a fn item and `cargo check --all-targets` failed with E0434. Move the block back to the end of the first test. One file, no other change; found by the caec1b07 audit and fixed the same way in the merge.
… does The worker-start reconcile test seeded the older ordered incarnation before the newer restore and the current machine record, so admission settled the older row itself; the fixture now registers the restore, the retired generation and then the older incarnation, and writes the machine record and the Sandbox tombstone after the seed, before the worker serves. The done-audit preview rows name the Branch the operator previewed, not main, and the doctor's worker-side read is one bounded 16-row page. Assert both as the p4 tree emits them. Tests: cargo test -p layerfs-control --test store_repair_live -> 2 passed.
…ema is The PostgreSQL DDL still constrained store_policy.schema_version and history_meta.schema_version to 2, so schema::create's insert of SCHEMA_VERSION (3) raised a check violation; every PostgreSQL create and open then failed with Malformed. A fresh Store creates, opens and projects store.status again. The diagnostic contract golden carries the same version. Tests: postgresql_open_check 3 passed; postgresql_status 1 passed (libpq and URL sources).
…topped machine merge-forms-root.sqlite was a released schema version 2 Store (user_version 42), which the lean open refuses by design. Regenerate it as a version 45 Store: the same root-form data, packs and allocation counters, carried into the current schema with the current schema source/definition, history serials and project epochs. The ignored generator's note names the current version. project.get needs the Store's live project list, so a stopped machine's worker refuses it Unavailable with the start hint; it starts nothing. The read test now pins that refusal instead of expecting a record-only answer. Tests: merge_mixed_forms 2 passed; merge_metadata_only 6 passed; machine_no_start 1 passed.
The table's help is "list, settle, release, audit or archive mount holders (operator)"; the test still expected the old list without archive. Tests: layerfs-cli --test gc -> 5 passed.
…window The mounted 64 MiB read reaches the Store in 141 demands with the SQLite engine's 512 KiB read-ahead window; PostgreSQL's larger window stays under 64. Keep the tight PostgreSQL bound and give SQLite its own 192-demands bound, still far below the about-512 one-demand-per-kernel-read case. Not run here: this host has no /dev/fuse. Evidence: the privileged FUSE lane's MOUNTED_READ sqlite object_batches 141; the PostgreSQL arm passed.
Run cargo +1.85.1 fmt --all, ruff format (0.17.2), and fix the product boundary and clippy findings. - Move the inline test modules out of src/ into tests/support files loaded by a path module; the product source keeps no test-only attributes. Tests moved: control doctor mount_holders/project_target, machine endpoint/record, sandbox tombstone, store place_view/service, history authority and store-service admission. - Add the documented line-limit waiver for the two inherited cohesive files (history records.rs and persistence admission.rs); every other file stays under 999 lines. - Clippy: allow the one removal-admission signature and the two operator repair signatures, elide two test lifetimes, drop a duplicate allow, and remove three needless borrows. - Ruff formats the 10 drifted tools files. Checks: fmt --check clean; ruff format --diff clean; boundary PASS (1575 files); tools unittest 195 passed; clippy --workspace --exclude layerfs-node --all-targets -D warnings clean.
Under the machine feature the worker route resolves the Store's owning machine from the home record; caller_home recorded the Store on box but no machine named box, so seven project_delete_worker cases failed NotFound before the fake worker saw the frame. Seed the machine record the code expects. Tests: project_delete_worker 8 passed with --features machine (and 8 without).
The diagnostic guard compares the live column projection with a golden that still carried a leading newline, so no freshly created Store could pass: schema_definition is exactly the ordered column lines, and the constant now is that text with one trailing newline. The compact, diagnostic, doctor and compact-fixture PostgreSQL suites run their offline audit again. Also make the PostgreSQL repair fixture's temp home owner-private, as the home guard requires. Tests: postgresql_compact 32 passed; postgresql_diagnostic 9; doctor_physical 16; open_check 3; acquisition 4; position_columns 4; compact_fixtures 9; doctor_access 10; status 1. repair_postgresql still stops at add_project's deliberate SQLite-only refusal (reported, not changed).
The engine reads objects in 512 KiB windows (history/objects/edges.rs BATCH_BYTES), so a 64 MiB sequential read costs about 141 Store demands on either backend; the kernel reads 128 KiB at a time, so no read-ahead would be about 512. The PostgreSQL arm asserted 64, which no measured run supports (the mounted lane measured 140 at a0ef644), so the split bound is one 192 for both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lean phase-3 GC authority — final
p4-lean-phase3@ba4469db(p4 code + docs), based onlayerfs_v2_0_0ed9118963.What this is
gc_intentkeeps 4 authority columns; orderedMachineRecord.incarnation/SandboxRecord.generation; machine-level tombstonemachine/<machine>/sandbox-retired/<name>.json; compactCopy::Donekeeps the done-row audit;store.repair_mount_holders+ bounded done row read.gc_machine_authority,gc_sandbox_tombstone,gc_audit, the two authority migrations,gc_authority.sql, old-source acceptance, blank-boundary compat. 2.0 schema version bumped directly (SQLite 39/40/41, PG 3).LayerFS-GC-spec.md,gc-runbook.md,mount-authority-lease.mdupdated to the lean design (no Store-side authority/tombstone/audit tables; per-machine conversion).Verification
cargo check --workspace --all-targetsexit 0.sandbox_get_no_lease(10) is a pre-existing Linux limitation (native sandbox is macOS-only), not a merge defect.Supersedes
Verification at 87890d7 (2026-11-24)
Run in a privileged Linux container with a real
/dev/fuse(the sandbox lacked it;--privilegedis required for the mount tests):kernel_application1,kernel_mount_routes2,observed_application8,r5_1_actual_daemon_commit1 — 12/12.install_directory4,kernel_guard5 (TMPDIRon ext4),closed_streams3 (build-identity bypass) — all pass.mounted_sequential_read: 2/2; 141 Store demands for 64 MiB on SQLite and 141 on PostgreSQL (bound 192). The old PostgreSQL bound of 64 had no code or measurement behind it: the engine reads ahead in 512 KiB windows (history/objects/edges.rsBATCH_BYTES).machine_list_live1/1;project_stats4/4,store_stats2/2,saved_continuation2/2, each on a cleanlayerfsschema.-D warnings; every test target builds.Known limitations (pre-existing; neither is run by
tools/ci/test_store_ext4.sh)repair_postgresqlcannot pass on PostgreSQL as written: its setup callsadd_project, which is deliberately SQLite-only ("adding a project needs a SQLite Store"). It needs theproject.initsetup path.project_statsandstore_statscannot share one PostgreSQL database: onelayerfsschema is one Store, so the second binary'sproject.initmeets the first's projectp. Each passes alone on a clean schema; the CI lanes run targets separately.