fix(data): close concurrency and cleanup gaps found in review

- SQLite restore holds every pool slot instead of the write lock first,
  removing a lock-order deadlock with sessions that begin to write.
- PostgreSQL sessions always return their connection on dispose, a
  rollback while disposing never masks the original exception, and a
  busy session keeps its transaction until it is discarded.
- The pool disposes a connection whose health check the caller cancels.
- Listener commands keep their lock until the server answers and never
  tear a write with the caller's token; closing and pending no longer race.
- Tag replacement locks the sequence and the tag row; unused-tag cleanup
  locks candidates and re-checks them with a fresh snapshot; render
  counts and stats refreshes lock the sequence row on PostgreSQL.
- Sequence upserts keep rendered_count, which renders maintain.
- AuthenticationOk after an unfinished SCRAM exchange is rejected.
- Oversized read buffers are released; failed backups leave no .tmp;
  a zero idle lifetime is rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 10:27:19 +00:00
1 parent 8d9b04c713
commit fb42423346
17 files changed
+240 -61

No files matched your search

@@ -81,6 +81,9 @@ public sealed class ValueConversionTests
"INSERT INTO t (a, b, c) VALUES ($1, $2, $3) ON CONFLICT (a) DO UPDATE SET b = excluded.b, c = excluded.c",
SqlDialect.Upsert("t", ["a", "b", "c"], 1));
Assert.Equal("INSERT INTO t (a, b) VALUES ($1, $2) ON CONFLICT (a, b) DO NOTHING", SqlDialect.Upsert("t", ["a", "b"], 2));
Assert.Equal(
"INSERT INTO t (a, b, c) VALUES ($1, $2, $3) ON CONFLICT (a) DO UPDATE SET c = excluded.c",
SqlDialect.Upsert("t", ["a", "b", "c"], 1, ["b"]));
Assert.Equal("%50\\%\\_off\\\\%", SqlDialect.ContainsPattern("50%_off\\"));
Assert.Equal("\"we\"\"ird\"", SqlDialect.QuoteIdentifier("we\"ird"));
}