Files
synapse/synapse
Erik JohnstonandClaude Opus 4.8 9eab4070bc Add runQuery / runOperation / connect to the Rust connection pool
`RustConnectionPool` stands in for `DatabasePool._db_pool`, a
`twisted.enterprise.adbapi.ConnectionPool`. It presented the slice Synapse's
`DatabasePool` uses (`runWithConnection`, `threadID`), but some tests reach for
`_db_pool` directly and call adbapi's `runQuery` / `runOperation` / `connect`,
which weren't implemented — so those tests errored with `AttributeError` on the
Rust backend.

Add them, mirroring adbapi's semantics:

  - `runQuery` / `runOperation` run one statement in its own transaction on a
    worker thread (commit on success, roll back on error), returning the rows
    (or nothing) as a `Deferred`.
  - `connect` returns a connection for direct synchronous use on the caller's
    thread, cached per thread as adbapi does and closed together with the pool.

Fixes the tests.storage.test_appservice and tests.storage.test_rollback_worker
failures on the Rust backend (26/26 pass); psycopg2 and sqlite are unaffected
(they use the real adbapi pool).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d
2026-07-11 09:04:57 +00:00
..
2026-06-02 11:05:38 +01:00
2026-05-29 10:57:33 +00:00