perf(staging): batch push retirement and reduce edited-push latency - #161
Conversation
Fix for branch-fanout protocol-v2 qualification failureThe failed CI reader had correct content and passed strict Git fsck, but the required protocol-v2 packet trace was absent. The original CI log does not record the owner probe, so the exact scheduling interleaving cannot be reconstructed from that artifact alone. A controlled local RustFS probe reproduced the same symptom with only the generation-owner lease changed: v2 advertised before holding the lease, absent while held (clone content correct and fsck clean), and advertised again after restoring the lease. Eight- and 32-reader ungated baseline runs passed, confirming why an ordinary rerun alone was insufficient evidence. Removing the owner gate alone passed the CI-shaped replay but a 32-reader run still failed once. A second deterministic gate then paused a reader after the compacted manifest CAS and before catalog materialization: another helper rejected the durable pending handoff and withheld v2. The matching Rust regression also failed before the second fix. The complete fix removes the owner-activity gate and its diagnostic journal LIST, and recognizes a bounded pending visibility handoff bound to the compacted manifest. The shared metadata parser validates that binding for both admission discovery and handoff application. The existing published-proof predicate is unchanged: owners must not confuse pending evidence with completed publication and skip materialization. Actual fetch admission retains bounded owner/repair waiting, cancellation, complete base/edit validation, generation-pinned visibility authorization, and exact comparison with the discovered refs and pack inventory. No format, dependency, lock or staging-retirement changes. Evidence map: Is this the best fix rather than merely plausible? Protocol support should not depend on a one-read advisory owner hint or on whether another reader has finished materializing an already-published handoff. Recognizing the existing durable state fixes both gaps without sleeps, retries in the CI assertion, weaker object checks, or a compatibility fallback. Existing owner-aware fetch admission remains canonical. Regression: the added active-owner assertion in Validation: full default-feature Crab library 4,145 passed, 3 ignored, using CI's 8-MiB test-thread stack. An initial default-stack replay overflowed; no production or test assertion change was used to bypass it. Release build and live replay results follow below. Intermediate owner-only build Final source: 4,145 Crab library tests passed, 3 ignored, including both new regression assertions and the unchanged missing-evidence rejection cases. 34 metadata visibility tests passed, including pending target-generation/pack-binding rejection. The metadata no-default-feature check passed with four existing unused-item warnings in Final optimized binary SHA-256: Both direct 32-reader follow-up rounds passed: 96 successful branch-reader clones across three completed 32-reader rounds, with content and strict fsck checks. The final Crab CI lint-category gate and workspace format/diff checks passed (existing CI-allowed warnings retained). All disposable run data/caches and five task-created RustFS buckets were removed and bucket absence verified; reports, logs and clearly separated debug probes remain local. Commit: |
Summary
Measured performance
Fresh local RustFS qualification: 50 × 2-GiB large files, ten shared content families, 500 small code files, three versions. Approximately 20 GiB unique base content, not 100 GiB unique entropy.
Uploaded bytes are identical across the before/after scale runs: 57,579,824 and 57,285,483 bytes. The old aggregate timer included staging retirement, not just cache work. Same-snapshot SQL replay isolated per-file commits versus batching: 16.705 s → 1.686 s. The harness permission correction contributes separately to end-to-end improvements.
Verification
Detailed evidence, ownership map, binary provenance and limitations:
crab/docs/benchmarks/add-push-hardening-rustfs.md, section “Edited-push retirement follow-up”. Runtime source tested is this patch atop merged PR #156; the binary embeds its runtime-identical pre-squash revision, documented with SHA-256.Design and remaining gaps
Is this the best fix rather than merely plausible? Batching removes repeated durable commits/global scans at the staging owner boundary, instead of weakening durability or deferring cleanup. It also removes duplicated writer/read-only retirement loops. The tradeoff is a longer individual write transaction and potentially more WAL retained until commit. Ownership publication remains a separate transaction with existing retry/recovery.
Retirement still takes approximately 29 seconds at scale; metadata work remains material. Initial pushes and add wall times were slower on the shared workstation/USB SSD, so this does not establish improved add latency, universal low latency, all historical-version reconstruction, or production S3/GCS/Azure performance. All formats remain v1; no compatibility path is added.