Repository navigation
Replace internal connection pool state enum with a boolean - #4796
Open
priyankatiwari08 wants to merge 1 commit into
Open
priyankatiwari08 wants to merge 1 commit into
priyankatiwari08 wants to merge 1 commit into
Conversation
Fixes dotnet#4795 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Final human review is needed because completed current-head CI and required supplemental policy checks were not verified.
Review effort: Balanced
Findings: None
What changed in this PR
Simplifies internal connection-pool lifecycle tracking for #4795 without changing public connection-state APIs.
Changes:
- Replaces the state enum with a volatile running flag in both pool implementations.
- Updates lifecycle documentation, diagnostics, and test helpers.
- Adds shared lifecycle regressions and strengthens synchronous/asynchronous shutdown tests.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/WaitHandleDbConnectionPoolShutdownTest.cs | Uses running-state assertions. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/TransactedConnectionPoolTest.cs | Removes obsolete mock state property. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/DbConnectionPoolRunningTest.cs | Adds cross-pool lifecycle tests. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/ChannelDbConnectionPoolTest.cs | Removes redundant enum-property tests. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/ChannelDbConnectionPoolShutdownTest.cs | Verifies parked waiters receive the shutdown error. |
| src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/ChannelDbConnectionPoolPruningTest.cs | Updates pruning shutdown assertions. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/WaitHandleDbConnectionPool.cs | Replaces enum checks with the running flag. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/IDbConnectionPool.cs | Removes State and documents lifecycle semantics. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolState.cs | Deletes the internal enum. |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/ChannelDbConnectionPool.cs | Replaces enum checks with the running flag. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4795.
DbConnectionPoolStateand the internalStateproperty with a volatile boolean exposed through the existingIsRunningcontract in both pool implementations.StartupandCleardo not resurrect retired pools.SqlConnection.StateandSystem.Data.ConnectionStateare unchanged.Validation
--list-tests; no remainingDbConnectionPoolStatereferences;git diff --checkclean.Matrix command (run for Debug and Release):
These are isolated/mock pool tests; no external SQL Server credentials were required. Live SQL Server manual tests were not run for this internal representation-only refactor.
Checklist