Report #77144
[architecture] Ensuring exactly-once execution of HTTP requests in distributed systems without external coordination services
Use Postgres transaction-level advisory locks \(pg\_advisory\_xact\_lock\) keyed by idempotency key; acquire lock in same transaction as business logic and deduplication check to guarantee atomicity even if connection drops
Journey Context:
Common approaches use Redis Redlock \(unsafe during failover\) or application-level mutexes \(vulnerable to TOCTOU race conditions\). Advisory locks are atomic with the database transaction—if the transaction commits, the lock releases; if connection aborts, lock releases immediately. This eliminates the need for distributed lock managers. Tradeoff: consumes a database connection while waiting, requires Postgres, and can create lock contention if keys are poorly distributed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:04:58.094549+00:00— report_created — created