Repository navigation
upstream fixes C: storage, LTX and background budget (0079–0136 part C) - #72
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Security review in progress: the full-stack review (SecFinal13) found no High or Medium. Two Low hardening items on #280's |
|
@coderabbitai review |
Action not completed
|
8e737ff to
a41fef0
Compare
|
Independent security review record (merge gate), head
|
a41fef0 to
4f7d9bd
Compare
4f7d9bd to
2dc0ecc
Compare
|
Security review record, round 3, head
SecFinal13 round 3: OK, no findings. It checked that the #245 GET fallback fails closed and its caller retries, that heartbeats can't starve the tail or outlive it, and that the Local run at the stack tip |
2dc0ecc to
51c95f6
Compare
|
Security review record, round 4. CodeRabbit raised two more issues on #71, both fixed:
SecFinal13: OK. The ephemeral boot doesn't write under the old identity or assume lease authority, and the address guard fails safe. Stack tip |
) (0098) After a successful L1 fold, delete local L0 files whose max TXID the fold covered, keeping the newest file that pos() and verify read back. Each activation and each node startup also drops live-named epoch dirs a newer local epoch supersedes, skipping resident replicas; the clean-reload path already pruned to its exact resident set, so the startup sweep is a no-op there and every other boot restores from the bucket.
Concurrent PUTs used to pile onto objects.sqlite3 with one connection and Immediate transaction each, losing the SQLite lock lottery into busy_timeout sleeps: aggregate write throughput collapsed toward one fsync per write and unlucky uploads stalled seconds past the durability budget (DurabilityUnproven under fan-out, plus renewal starvation that can self-fence the node). Every put now funnels through one writer thread, one connection, and one queued batch per transaction. Draining whatever is already queued costs nothing when idle (a batch of one is today's single PUT) and shares one commit fsync under load; each row keeps its own savepoint so Create/Update conflicts still fail alone. A panicked writer falls back to a direct PUT rather than failing every write.
The 0.6.0-0.6.2 import tested page_count == 0, but under replication the replica opens the facet file first and its control tables already push the count past zero, so the import never ran: silent upgrade data loss. The check is now no-user-data, which also repairs the files those versions left behind. The image replays through ordinary SQL writes, which commit beside a live replica read lock (a Backup would take EXCLUSIVE and fail), and the decision is stamped in user_version so a later wipe never resurrects. Live file content always wins over the legacy image, which is safe because 0.5.1 never wrote facet files; the legacy row stays for manual recovery. One corner remains: an all-content wipe made on 0.6.0-0.6.2 followed by this upgrade replays the image once; delete again on the fixed version.
A handler that answers but leaves timers or waitUntil pending holds its drive's affiliation until the event finishes, so a retiring generation's isolates never drain: each deploy leaks a heap until shedding latches CapacityExhausted forever. Past the background budget (30 s, Cloudflare's waitUntil limit) the driver ends the background work without failing the answered request, and the abort pass releases the isolate. An event that still holds the cell's input gate or runs another event's critical section keeps its ops by design, and stays loud about it.
A full walk of the cut per faulted read made a whale's fill quadratic in its size (111 min for 8.9 GB) and stalled foreground reads behind the walk's mutex hold. The hydration set now carries an exact cut-relative count, maintained on every insert and truncation, so hydration() is constant time. Live file content still always wins over fault data, and the count never covers the lock page or past-cut holes.
…0103) A follower dropped a sealed fragment only when its record said so, but a restarted leader moves its lease to the new generation and a dead session never opens a new epoch: the old generation's record reads back absent, and the sweep skipped it forever. An absent record now counts as closed — the fragments are garbage no new epoch will ever adopt — while a read error still retries next pass. The seal mark extends as before, so a straggling append is refused rather than resurrected.
#291) (0104) A write that fails with SQLITE_FULL, IOERR, NOMEM, or INTERRUPT destroys its transaction, and every later event on the cell — reads included — failed until something reopened the database. Only an eviction recovered the cell. The actor now restarts the runtime when a finished activity leaves its scope broken; the swap pump carries the restart on the current generation, and the placement opens the database on a fresh isolate, which clears the poison. Downgrade-safe: the mark lives only in memory and a reopen clears it.
) (0105) A node that lost its DO to another node kept the dead live-named files forever after a crash or a handoff=preserve stop, rotting outside the local-cache budget. At boot after predecessor recovery — unless the boot is a clean reload — the node now deletes every live-named epoch, since only a clean reload resumes one and a restart claims each cell at a new epoch from the bucket. The deleted cells stay in a take-once boot list that the local reload replays, so ownership confirmation still finds the cells that were resident when the predecessor died.
51c95f6 to
e795fcb
Compare
|
Security review record, rounds 5–7, head This round's fixes, all folded into their patches:
SecFinal13:
Local run, 1.98.1, release profile: |
Part C of 6 for
v0.6.3-ryuzcorp.13: upstream denoland/celld issue fixes, family C (storage, LTX and background budget). Stacked: merge bottom-up; after each merge the next layer is rebased ontoryuzcorp/v0.6.3(rebase merge keeps one commit per patch).Patches
d742362storage: retain local L0/epoch LTX files after compaction (upstream feat: report each node serving version #311) (0098)cd93641storage: dev-store single-writer group commit (upstream fix: trim compacted live-epoch dev L0s #310) (0099)bc79122storage: repair 0.5.1 facet-image import (upstream cron: next_after returns a time before after_ms at i64::MAX (upstream denoland/celld#321) #292) (0100)a164abbruntime: bound post-response background work (upstream workerd diff: Workflow status() carries rollback:null and sendEvent to a complete instance is refused #275) (0101)c68fdd8ltx: keep an O(1) hydration count (upstream workerd diff: compression close/abort precedence and an empty DecompressionStream close #270) (0102)303ed16node-log: collect fragments of record-less sessions (upstream workerd diff: ctx.exports in a Durable Object isolate lists only default #259) (0103)03fb18druntime: restart the cell after SQLite destroys a transaction (upstream release: 0.3.1 #291) (0104)8e737ffstorage: prune live-named epochs after an unclean restart (upstream workerd diff (order only): plain-stream abort() resolves before writer.closed rejects #290) (0105)Review
Review C (reviewer agent,
celld --lib454 green): ship it. Lows fixed: #275background_sincere-arms after expiry (one warn per budget window, test); #259 GC skips the live-lease-without-log case and collects only terminal absences (test).Every fix has a fail-before test (fix reverted → test fails).
.github/andDockerfileare untouched across the whole stack (git diff 00df62d p13/F-misc -- .github Dockerfileis empty). The independent security review of the full stack is recorded as a comment before merge.Verification (full stack tip
12cbf4e, toolchain 1.98.1, CI profilerelease)cargo clippy --profile release --all-targets --locked -- -D warnings: clean.cargo test --profile release --locked: every suite ok (52 result lines, 0 failed).cargo check --all-targetspasses at every family boundary and at every patch a fixup touched.FORK.mdpatch entries (0079–0136, shas filled after merge) and release notes follow in a separate PR, as for.11/.12.