pg-fix-scheduler-fire-wake — the scheduler tick's fire wake lands, closing the recorded cross-engine fire-wake latency-parity gap (the wave-5 gate's one standing item, review-wave-4-fixes' recorded-for-later note): scheduler.rs::tick now issues one coalesced pg_notify per firing schedule per tick after the fire loop, still inside the tick's in_tx frame — channel = the fired queue's name (schedule() rejects reserved names per ADR-021 §3, so the plain queue name is always the right channel), empty payload (Wake { channel } only, ADR-008 §3), best-effort via the shared tx::wake_tx (widened private → pub(crate) per the recorded one-call shape; enqueue_row stays wake-free — no double-wake; auto-commit Queue::enqueue and the tx producer paths untouched). NOTIFY's native transactional delivery makes the wake commit-atomic: a rolled-back tick (crash mid-tick ⇒ boundary refires) discards the wake with its fire rows — the tx/no-ghosts discipline the tx producer paths already pin; coalescing default one-per-firing-schedule-per-tick (not per-fire) matching the SQLite watcher's per-committed-tick cadence, decision recorded in the task's Notes. New four-arm pinning test (scheduler_tests.rs, tx_producer_wakes_are_commit_atomic pattern): pre-commit silence inside the runner's own in_tx frame driving the engine's own tick (rogue-ticks shape), deterministic delivery at/after commit, coalescing (≥2 boundaries → one wake), nothing-due silence (same-tick not-due schedule + a later all-not-due tick, in-frame and post-commit), and the end-to-end runner leg (a live run_schedules leader's wake reaches a registered listener); local listener_hears helper per the per-file helper convention; rollback arm native (NOTIFY transactional delivery — no tick-fault seam built, per the task pin). Docs: tx.rs 'The tx wakes' section + wake_tx doc name the scheduler fire path as a shared caller; scheduler.rs module docs + tick doc pin the coalesced commit-atomic semantics. Record updates: review-wave-4-fixes' recorded-for-later bullet, suite-scheduler-rows' gate disposition note + Notes bullet, review-wave-5 §Notes 4's audit row — all retired with pointers; implementation.md gains the review-rounds line (fires visible to registered listeners ahead of the mem engine's posture being written). Also carried: review-wave-5 §6 flake-ledger update — row_lock_ttl_expiry_and_reacquisition failed once more in a full pg run this session (green on the next two full runs + six focused; unrelated mechanism to this change), meeting the ledger's own 'fails again' trigger with the dedicated investigative session owed by the wave-7 watch carriage. Verified: full pg lib suite 122/122 vs the harness (new test green ×3 solo); pg contract suite 25/25 + schema 9/9; workspace cargo test green server-less (pg skips clean incl. the new test); clippy --all-targets -D warnings clean; fmt clean
This commit is contained in:
1 parent
5abd351c86
commit
57451cef46
8 files changed
+538
-14
No files matched your search
@@ -63,7 +63,10 @@
|
||||
//! channel realization) **inside the caller's transaction** ([`wake_tx`]).
|
||||
//! NOTIFY's native transactional delivery makes the wake commit-atomic:
|
||||
//! it delivers at the caller's COMMIT, and a rollback discards the row
|
||||
//! *with* its wake (the tx/no-ghosts rows' pin). Wakes are best-effort
|
||||
//! *with* its wake (the tx/no-ghosts rows' pin). The scheduler's tick
|
||||
//! fire path rides the same [`wake_tx`] (one coalesced wake per firing
|
||||
//! schedule per tick, on the fired queue's name — the scheduler's
|
||||
//! docs). Wakes are best-effort
|
||||
//! (ADR-006; the engine-wide posture — a wake must never fail a write):
|
||||
//! a failed statement is logged and swallowed, and since a failed
|
||||
//! statement aborts the tx server-side the truth still surfaces typed
|
||||
@@ -283,8 +286,10 @@ fn enqueue_row_sql(schema: &str) -> String {
|
||||
/// effort at the op (the engine-wide posture — a wake must never fail
|
||||
/// a write): a failed statement is logged and swallowed; because a
|
||||
/// failed statement aborts the tx server-side, the truth still
|
||||
/// surfaces typed at COMMIT.
|
||||
async fn wake_tx(client: &tokio_postgres::Client, channel: &str) {
|
||||
/// surfaces typed at COMMIT. Shared by the tx producer paths and the
|
||||
/// scheduler's tick fire path (the tick's in-tx fire wake — the same
|
||||
/// commit-atomic semantics at the tick's own `in_tx` frame).
|
||||
pub(crate) async fn wake_tx(client: &tokio_postgres::Client, channel: &str) {
|
||||
if let Err(wake_err) = client
|
||||
.query_one("SELECT pg_notify($1, '')", &[&channel])
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user