Repository navigation
fix(connection_pool): do not cache cursor when cursor_init fails - #6303
brucearctor wants to merge 1 commit into
Conversation
Signed-off-by: Bruce Arctor <5032356+brucearctor@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Summary
Fixes a bug in
ConnectionPool.get_cursor()(noticed during review of #6300) where the newly created cursor was cached inself._thread_cursors[thread_id](_ThreadLocalBase) orself._cursor(SingletonConnectionPool) beforeself._cursor_init(cursor)ran.If
_cursor_initraises (for example, a failed DuckDB extension load, RisingWave sessionSET, or DorisSWITCH/USE), a subsequentget_cursor()retry on the same thread/pool would return the uninitialized cached cursor and skip_cursor_init._cursor_init(cursor)succeeds._try_close(cursor, "cursor")and re-raise.SingletonConnectionPool,ThreadLocalConnectionPool, andThreadLocalSharedConnectionPool.Verification
ruff checkandruff format --check --line-length 100: passedmypy sqlmesh/utils/connection_pool.py: passedpytest tests/utils/test_connection_pool.py: 17 passed