Bound PostgreSQL dead-peer detection for writer fencing
build / build (push) Failing after 1m43s

This commit is contained in:
2026-10-07 14:05:22 +02:00
parent 952b179d9a
commit 756ab7c65b
3 changed files with 60 additions and 0 deletions
+31
View File
@@ -1,5 +1,36 @@
# btcdata Kubernetes deployment plan
## 2026-10-07 incident: orphaned writer session
The `sejs/btcdata` pod on citadel entered CrashLoopBackOff with
`Another btcdata writer holds the database lock`. The prior pod on srv1893094
had been removed after readiness/network failures, but its PostgreSQL backend
(PID 3531439, client 100.75.252.111) still held advisory lock 728194106. No old
btcdata Java process or database TCP connection remained on that node.
Recovery terminated only that verified orphaned backend. Kubernetes restarted
btcdata successfully; btcdata and both btcprice pods became Ready. Do not bypass
the advisory lock or terminate its owner without first verifying the old writer
is stopped.
Production database `btcprod` now has connection defaults:
`tcp_keepalives_idle=60`, `tcp_keepalives_interval=10`,
`tcp_keepalives_count=3`, and `tcp_user_timeout=90000` (milliseconds).
These apply to **new connections**, not the already-running recovered session.
Server-side dead-peer detection prevents a disappeared node from retaining the
lock for the default multi-hour TCP timeout; it does not evict a live competing
writer. The application now also sets these values on its lock-owning session
before acquiring the fence (source change; not yet built/deployed).
Validation: 20 unit tests / 58 assertions passed; disposable PostgreSQL integration
tests were not run because the local Docker daemon was unavailable. New
production connection settings were verified with `SHOW`.
Rollback database defaults, if necessary, with `ALTER DATABASE btcprod RESET
<setting>` for each of the four settings above; new connections inherit the
server defaults again. Reverting the application change requires a normal image
build and Flux rollout. The orphan-session termination is not reversible.
## 2026-09-19 status and proposed recovery
Kubernetes deployment already exists: one `Recreate` replica on citadel, eligible