pg: server-side stamp sums saturate to the i64 domain — the review-004 item-5 sticky-poison class dies (pg-fix-bigint-stamp-overflow): every stamp sum/subtraction computes in numeric via one owner (resolution::saturating_stamp_expr, the ADR-023 §2 2026-10-11 annotation's form) called at all six sites — claim deadline (queue.rs:385), retention sweep (:721), retry reschedule (:927), heartbeat renewal (:1016), lock insert + renew (lock.rs:95/222); the realized ($N::bigint)::numeric chain pins the params' inferred bigint type (a bare $N::numeric fails the i64 binding with WrongType — found live, recorded in the owner's doc); behavior pinned against the harness server per site (i64::MAX stamp claims to the i64::MAX deadline with neighbors unaffected, heartbeat extremes renew to the saturated edge and now+MIN rides exact then voids through the validity predicate, retry Some(i64::MIN)/(i64::MAX) reschedule, retention i64::MIN sweep-all + i64::MAX delete-nothing, ttl i64::MAX insert+renew); two consecutive full-crate harness runs green (135+25+9), workspace gates + fuzz corpus gate green server-less; no re-deciding, no contract-text change (the failure-set change was the decision's own annotation); task -> completed
This commit is contained in:
1 parent
60f7d02769
commit
ce5da852ca
6 files changed
+400
-25
No files matched your search
@@ -35,7 +35,7 @@ use deadpool_postgres::Pool;
|
||||
|
||||
use alkstore::{BoxedFuture, Lock, Result, validate_local_name, validate_shared_name};
|
||||
|
||||
use crate::resolution::now_unix;
|
||||
use crate::resolution::{now_unix, saturating_stamp_expr};
|
||||
use crate::schema::{QualifiedTable, tables};
|
||||
use crate::seam::{database_error, pg_error, pool_error};
|
||||
|
||||
@@ -89,9 +89,10 @@ pub(crate) async fn lock_acquire(
|
||||
.execute(
|
||||
&format!(
|
||||
"INSERT INTO {locks} (name, owner, expires_at)
|
||||
VALUES ($1, $2, $3::bigint + $4::bigint)
|
||||
VALUES ($1, $2, {expires_at})
|
||||
ON CONFLICT (name) DO NOTHING",
|
||||
locks = table(schema, tables::LOCKS)
|
||||
locks = table(schema, tables::LOCKS),
|
||||
expires_at = saturating_stamp_expr("($3::bigint)::numeric + ($4::bigint)::numeric"),
|
||||
),
|
||||
&[&name, &owner, &now, &ttl],
|
||||
)
|
||||
@@ -214,9 +215,11 @@ impl Lock for PgLockHandle {
|
||||
let n = client
|
||||
.execute(
|
||||
&format!(
|
||||
"UPDATE {locks} SET expires_at = $3::bigint + $4::bigint
|
||||
"UPDATE {locks} SET expires_at = {expires_at}
|
||||
WHERE name = $1 AND owner = $2",
|
||||
locks = table(&schema, tables::LOCKS)
|
||||
locks = table(&schema, tables::LOCKS),
|
||||
expires_at =
|
||||
saturating_stamp_expr("($3::bigint)::numeric + ($4::bigint)::numeric"),
|
||||
),
|
||||
&[&name, &owner, &now, &ttl],
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user