Skip to content

New pool scaffolding #3352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 22, 2025
Merged

Conversation

mdaigle
Copy link
Contributor

@mdaigle mdaigle commented May 15, 2025

This is the first PR targeting #3356. The goal of this PR is to be non-disruptive and create a separate workspace for the new connection pool implementation.

  • Introduces an app context switch to control pool version used
  • Adds a shim class for the new connection pool implementation.
  • Marks DbConnectionPool methods that are only called from within the class as private to simplify the API.
  • Renames PutObject to ReturnInternalConnection for clarity.

To see the POC implementation, take a look at #3211

@Copilot Copilot AI review requested due to automatic review settings May 15, 2025 21:52
@mdaigle mdaigle requested a review from a team as a code owner May 15, 2025 21:52
Copilot

This comment was marked as outdated.

@mdaigle mdaigle requested a review from Copilot May 15, 2025 21:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds scaffolding for a new V2 connection pool implementation, introduces an app-context switch, and simplifies the existing pool API by privatizing and renaming methods.

  • Introduce UseConnectionPoolV2 switch in LocalAppContextSwitches
  • Rename PutObject to ReturnInternalConnection and mark methods private where appropriate
  • Add ChannelDbConnectionPool stub and switch selection logic in DbConnectionPoolGroup

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
LocalAppContextSwitches.cs Added UseConnectionPoolV2 switch constant, backing field, and property
WaitHandleDbConnectionPool.cs Privatized pool internals, renamed PutObject calls to ReturnInternalConnection, updated argument names
DbConnectionPoolGroup.cs Switched instantiation between WaitHandleDbConnectionPool and ChannelDbConnectionPool based on the new switch
DbConnectionPool.cs Renamed abstract PutObject to ReturnInternalConnection, removed obsolete methods
ChannelDbConnectionPool.cs Added new stub class with unimplemented methods
DbConnectionInternal.cs Updated internal call from PutObject to ReturnInternalConnection
*.csproj (netfx/netcore) Added ChannelDbConnectionPool to project files, relocated WaitHandleDbConnectionPool entries
Comments suppressed due to low confidence (1)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/ChannelDbConnectionPool.cs:22

  • All methods in ChannelDbConnectionPool are currently stubs throwing NotImplementedException. Without implementations and corresponding tests, switching to V2 will break at runtime. Add implementations (or at least safe fallbacks) and unit tests before enabling this path.
internal override int Count => throw new NotImplementedException();

Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 17 lines in your changes missing coverage. Please review.

Project coverage is 58.65%. Comparing base (dc1298a) to head (831dc5b).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...lient/ConnectionPool/WaitHandleDbConnectionPool.cs 75.86% 14 Missing ⚠️
...icrosoft/Data/ProviderBase/DbConnectionInternal.cs 80.00% 1 Missing ⚠️
.../SqlClient/ConnectionPool/DbConnectionPoolGroup.cs 91.66% 1 Missing ⚠️
...icrosoft/Data/SqlClient/LocalAppContextSwitches.cs 80.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (dc1298a) and HEAD (831dc5b). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (dc1298a) HEAD (831dc5b)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3352      +/-   ##
==========================================
- Coverage   65.16%   58.65%   -6.52%     
==========================================
  Files         300      293       -7     
  Lines       65379    65073     -306     
==========================================
- Hits        42606    38169    -4437     
- Misses      22773    26904    +4131     
Flag Coverage Δ
addons ?
netcore 62.75% <80.00%> (-5.67%) ⬇️
netfx 59.60% <80.00%> (-6.73%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

Some simple doc fixes, and a philosophical question.

@mdaigle
Copy link
Contributor Author

mdaigle commented May 16, 2025

@imasud00 @paulmedynski I've addressed your comments if you can take another look, please

paulmedynski
paulmedynski previously approved these changes May 16, 2025
Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Some comments I'd like addressed, some comments don't matter that much.

benrr101
benrr101 previously approved these changes May 19, 2025
Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for addressing the comments

imasud00
imasud00 previously approved these changes May 19, 2025
Copy link

@imasud00 imasud00 left a comment

Choose a reason for hiding this comment

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

:shipit:

@mdaigle mdaigle dismissed stale reviews from imasud00, benrr101, and paulmedynski via 6ea1491 May 20, 2025 10:46
Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

We're also missing some switches in :

src/Microsoft.Data.SqlClient/tests/FunctionalTests/LocalAppContextSwitchesTests.cs

Can you add the currently missing ones and your new switch?

Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Sure, removing the test is acceptable too 😅

@mdaigle mdaigle merged commit e25b768 into dotnet:main May 22, 2025
237 checks passed
@mdaigle mdaigle deleted the dev/mdaigle/new-pool-scaffolding branch May 22, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants