mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-15 11:20:38 +00:00
Constructing a `MultiWriterIdGenerator` prunes stale `stream_positions` rows for writers no longer in the config. The test harness built each generator inside a `runWithConnection` callback and never committed, so that cleanup only persisted because adbapi keeps one connection per thread and leaves its transaction open across calls — a later generator on the same thread then saw the uncommitted delete. The native Rust pool hands out a fresh connection per call and rolls back any left mid-transaction, so the cleanup was lost and test_writer_config_change read a stale writer position (persisted-upto 3 instead of 6). Commit the connection after constructing the generator, so the cleanup persists regardless of pool semantics; the delete is legitimate work that should be committed anyway. Fixes test_writer_config_change on the Rust backend; psycopg2 and sqlite still pass (16/16 on both). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3G4M92AmwSSZCbmtMJU3d