Add M10.8d two-process handoff fault matrix and recovery fixes
Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Failing after 10m4s
Foundation / checks (network) (push) Successful in 13m3s
Foundation / checks (tsan) (push) Successful in 7m53s
Foundation / checks (checks) (push) Successful in 32m18s
Foundation / checks (postgres) (push) Successful in 43m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Failing after 10m4s
Foundation / checks (network) (push) Successful in 13m3s
Foundation / checks (tsan) (push) Successful in 7m53s
Foundation / checks (checks) (push) Successful in 32m18s
Foundation / checks (postgres) (push) Successful in 43m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR-0096. Two real evo-server processes on PostgreSQL (regions 7/161 and 7/162, adjacent areas) run crossings and crossings back, SIGKILL of the source after prepare and of the destination after stage and after commit, duplicate and stale ticket retries, a client that never arrives and a destination that is down. After every scenario SQL checks one owner per probe, the conserved inventory and frozen-iff-open-transfer. The matrix found two recovery gaps, now fixed: - a source restarted after a prepare left the probe frozen for good (its abort deadline was in memory): schema v14 overdue_probe_transfers and a session-layer sweep abort open outgoing transfers past the ticket lifetime plus 10 s by the database clock; - a ticket replayed at a restarted destination after the probe moved on took control back: admission of a committed transfer now requires the record as that commit left it. M10.8 is complete. Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
-- M10.8d overdue probe transfers (ADR-0096). A source region aborts the transfers whose
|
||||
-- client never arrived once their ticket has expired; it kept that deadline only in memory,
|
||||
-- so a source restarted after a prepare (SIGKILL, lease loss) left the probe frozen for good.
|
||||
-- This lists the caller's open outgoing transfers prepared more than `p_age_seconds` ago by
|
||||
-- the database clock, so any later process holding the region's lease can abort them (abort
|
||||
-- is serialized with stage and commit: a transfer committed meanwhile stays committed).
|
||||
-- Read-only, under the caller's exact unexpired region lease. At most 256 rows, oldest first.
|
||||
CREATE FUNCTION evolution.overdue_probe_transfers(p_world evolution.u64, p_region evolution.u64,
|
||||
p_holder uuid, p_epoch evolution.u64, p_age_seconds integer)
|
||||
RETURNS TABLE (transfer_id uuid)
|
||||
LANGUAGE plpgsql SECURITY DEFINER SET search_path = pg_catalog, pg_temp AS $$
|
||||
DECLARE
|
||||
now_t timestamptz;
|
||||
BEGIN
|
||||
IF p_age_seconds IS NULL OR p_age_seconds NOT BETWEEN 1 AND 86400 THEN
|
||||
RAISE EXCEPTION 'invalid probe request' USING ERRCODE = '22023';
|
||||
END IF;
|
||||
now_t := evolution.check_region_lease(p_world, p_region, p_holder, p_epoch);
|
||||
RETURN QUERY
|
||||
SELECT t.transfer_id
|
||||
FROM evolution.probe_transfers t
|
||||
WHERE t.world_id = p_world AND t.source_region = p_region
|
||||
AND t.state IN ('prepared', 'staged')
|
||||
AND t.prepared_at < now_t - p_age_seconds * interval '1 second'
|
||||
ORDER BY t.prepared_at, t.transfer_id
|
||||
LIMIT 256;
|
||||
END $$;
|
||||
|
||||
REVOKE ALL ON FUNCTION
|
||||
evolution.overdue_probe_transfers(evolution.u64, evolution.u64, uuid, evolution.u64, integer)
|
||||
FROM PUBLIC;
|
||||
GRANT EXECUTE ON FUNCTION
|
||||
evolution.overdue_probe_transfers(evolution.u64, evolution.u64, uuid, evolution.u64, integer)
|
||||
TO :"runtime_role";
|
||||
INSERT INTO evolution.schema_migrations(version, sha256) VALUES (14, :'migration_sha_14');
|
||||
+27
-3
@@ -65,28 +65,43 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
||||
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
||||
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
||||
|| ',13:' || :'migration_sha_13' AS at_v13 \gset
|
||||
\if :at_v13
|
||||
|| ',13:' || :'migration_sha_13' AS at_v13,
|
||||
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
||||
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
||||
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
||||
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
||||
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
||||
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
||||
|| ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14'
|
||||
AS at_v14 \gset
|
||||
\if :at_v14
|
||||
\elif :at_v13
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v12
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v11
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v10
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v9
|
||||
\ir 0010_account_control.sql
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v8
|
||||
\ir 0009_serialized_authority.sql
|
||||
\ir 0010_account_control.sql
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v7
|
||||
\ir 0008_upgrade_barrier.sql
|
||||
\ir 0009_serialized_authority.sql
|
||||
@@ -94,6 +109,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v6
|
||||
\ir 0007_region_clones.sql
|
||||
\ir 0008_upgrade_barrier.sql
|
||||
@@ -102,6 +118,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v5
|
||||
\ir 0006_commit_lookup.sql
|
||||
\ir 0007_region_clones.sql
|
||||
@@ -111,6 +128,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v4
|
||||
\ir pre_v5_guard.sql
|
||||
\ir 0005_batch_decisions.sql
|
||||
@@ -122,6 +140,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v3
|
||||
\ir 0004_lineage_profile.sql
|
||||
\ir pre_v5_guard.sql
|
||||
@@ -134,6 +153,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v2
|
||||
\ir 0003_region_checkpoints.sql
|
||||
\ir 0004_lineage_profile.sql
|
||||
@@ -147,6 +167,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\elif :at_v1
|
||||
\ir 0002_region_fencing.sql
|
||||
\ir 0003_region_checkpoints.sql
|
||||
@@ -161,6 +182,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\else
|
||||
\echo 'Unknown or changed migration history'
|
||||
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
|
||||
@@ -180,6 +202,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
|
||||
\ir 0011_region_actions.sql
|
||||
\ir 0012_probe_handoff.sql
|
||||
\ir 0013_probe_incoming.sql
|
||||
\ir 0014_probe_overdue.sql
|
||||
\endif
|
||||
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
|
||||
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC
|
||||
@@ -226,7 +249,8 @@ BEGIN
|
||||
('evolution.abort_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
||||
('evolution.find_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
||||
('evolution.handoff_account_control(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,uuid,evolution.u64,integer)'::regprocedure::oid),
|
||||
('evolution.incoming_probe_transfers(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid)
|
||||
('evolution.incoming_probe_transfers(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
||||
('evolution.overdue_probe_transfers(evolution.u64,evolution.u64,uuid,evolution.u64,integer)'::regprocedure::oid)
|
||||
), violations(role_oid, reason) AS (
|
||||
SELECT r.oid, 'privileged attribute or owner identity' FROM pg_catalog.pg_roles r
|
||||
JOIN closure c ON c.oid = r.oid
|
||||
|
||||
Reference in New Issue
Block a user