dotnet / dotnet/SqlClient

Add a separate timeout value for transaction operations such as commit

Open
#3,635 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 18h
Merged PRs (30d)
69

Description

### Is your feature request related to a problem? Please describe.
Currently, operations on transactions such as Commit rely on the connection timeout. We would like to increase the commit timeout, but increasing the connection timeout has too many side effects, as we would end up waiting a long time in cases where the database is inaccessible or in case of misconfiguration.

### Describe the solution you'd like
Either
a) Add a separate timeout, for example TransactionTimeout
or
b) Change Commit (and other transaction operations) to use the CommandTimeout, as we can increase that one without unintended side-effects.

### Describe alternatives you've considered
Our only alternative has so far been to increase the connection timeout, but we have already increased it to 1:30 minute (which is a long time to wait if you set the wrong database name etc.), and it's still not always enough for big transactions in Azure SQL.

### Additional context
Example of code using the connection timeout for transaction operation:
https://github.com/dotnet/SqlClient/blob/481a2c40b1d0b3d1f3b0d2cafbfa538362e508d9/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs#L1195C1-L1197C1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.