MSSQL multi-table reflection of temp tables still queries tempdb catalog by name; can deadlock
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the SQL Server dialect's get_multi_* reflection methods, especially get_multi_pk_constraint(), and the tempdb pass that filters tempdb.sys.* catalog views by resolved name. Compare it with the 2.0 column query, which already filters on object_id(). Done means the tempdb queries for PK, columns, indexes and table comment filter on the resolved object id, with a test showing reflection no longer blocks while another session holds temp table locks.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
#13754 changed the resolution of a #temp name to its internal tempdb name to
use object_id(), so that the lookup only sees the current session's table.
However, the SQL Server get_multi_* methods added in 2.1 (#8430) then run
their bulk catalog queries against tempdb.sys.*, filtering on the resolved
name rather than on the object id:
SELECT ...
FROM tempdb.sys.key_constraints
JOIN tempdb.sys.objects ON key_constraints.parent_object_id = objects.object_id
JOIN tempdb.sys.schemas ON ...
JOIN tempdb.sys.index_columns ON ...
JOIN tempdb.sys.columns ON ...
JOIN tempdb.sys.indexes ON ...
WHERE key_constraints.type = 'PK'
AND schemas.name = 'dbo'
AND objects.name IN ('#mr_leak_tmp_____...0000000012CF')
Nothing in these queries limits them to one object, so the server is free to
read catalog rows for other sessions' temp tables in tempdb. When another
session is creating temp tables inside an open transaction, those rows are
locked, so reflection blocks or deadlocks:
(pyodbc.Error) ('40001', '[40001] [Microsoft][ODBC Driver 18 for SQL Server]
[SQL Server]Transaction (Process ID 73) was deadlocked on lock resources with
another process and has been chosen as the deadlock victim. Rerun the
transaction. (1205) (SQLFetch)')
This came up in CI in get_multi_pk_constraint(). The columns, indexes and
table comment queries in the tempdb pass use the same name-based filter.
The tempdb pass should filter on the object id that was already resolved.
2.0 is not affected. There, temp table reflection only queries tempdb for
columns, and that query already filters on object_id().
- Ngôn ngữ chính
- Python
- Star
- 12.3k
- Fork
- 1.8k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sqlalchemy/sqlalchemy
-
requires triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
sqlalchemy/sqlalchemy#13784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug engine
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sqlalchemy/sqlalchemy#13770 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
declared_attr.cascading fails to typecheck under mypy / pyright on documented usageCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug orm typing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
sqlalchemy/sqlalchemy#13731 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PostgreSQL multihost URL with bracketed IPv6 hosts raises ValueError: too many values to unpackCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug engine postgresql
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sqlalchemy/sqlalchemy#13637 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
asyncpg dialect raises DBAPIError, not DataError, for SQLSTATE class 22 errorsCó thể đã có người làm @HardMax71 đã nhận 21 ngày trước. Đang mởbug code review in progress dialects
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sqlalchemy/sqlalchemy#13636 · 19 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sqlalchemy/sqlalchemy
Issue tương tự
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsCó thể đã có người làm @himanchalkaushale đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OWASP/Nettacker#1884 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A-connection-core C-enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aws-samples/sample-per-model-bedrock#869 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Spec: say that included_antigen_sources gates LENS labels; do not merge it into antigen kindsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
fzn0x/watchtower#17 ·