Skip to content

Conversation

@ebyhr
Copy link
Member

@ebyhr ebyhr commented Nov 10, 2025

Description

Fixes #10846

Another approach would be adding retry logic.

Release notes

## SQL Server
* TBD. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Nov 10, 2025
@github-actions github-actions bot added the sqlserver SQLServer connector label Nov 10, 2025
@ebyhr ebyhr marked this pull request as draft November 10, 2025 08:41
@ebyhr ebyhr force-pushed the ebi/sqlserver-list-failure branch from f2ed50d to 207e1f9 Compare November 10, 2025 08:45
@ebyhr ebyhr marked this pull request as ready for review November 10, 2025 08:45
throws SQLException
{
Connection connection = connectionFactory.openConnection(session);
connection.setTransactionIsolation(TRANSACTION_READ_UNCOMMITTED);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the downside of using TRANSACTION_READ_UNCOMMITTED for table listing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside is potential risk of dirty reads. For instance, the connector might see a table that will be rolled back (doesn't really exist).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think "read uncommitted" is desired.
the sql server's snapshot isolation was supposed to avoid deadlocks.
Besides, listing operations should be retried on retryable exceptions (as should be all other forms of network communication with external services), and those retries would likely solve the problem at hand

@findinpath
Copy link
Contributor

Use TRANSACTION_READ_UNCOMMITTED for listing objects in SQL Server
This resolve "Transaction was deadlocked on lock resources with another process" when listing objects in SQL Server connector.

It would be worthwhile to explain what is the rationale for going with the TRANSACTION_READ_UNCOMMITTED isolation level.

{
super.testShowTablesLike();
try {
super.testUpdateRowConcurrently();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test creates test_update_row... tables which will likely left unaffected the SHOW TABLES LIKE 'or%' query from testShowTablesLike.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is fine because the condition isn't pushed-down to SQL Server. I confirmed the current test can reproduce a deadlock issue.

This resolve "Transaction was deadlocked on lock resources with another process"
when listing objects in SQL Server connector.
@ebyhr ebyhr force-pushed the ebi/sqlserver-list-failure branch from 207e1f9 to 17700c0 Compare November 14, 2025 01:47
@ebyhr ebyhr requested review from findepi and wendigo November 14, 2025 01:47
@ebyhr
Copy link
Member Author

ebyhr commented Nov 14, 2025

CI hit #26567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed sqlserver SQLServer connector

3 participants