Skip to content

#203: pooled PDO slot configuration (TLS options, setAttribute, inTransaction, POOL_MIN) - #210

Merged
EdmondDantes merged 2 commits into
mainfrom
203-pdo-pool-slot-configuration-changelog
Jul 23, 2026
Merged

EdmondDantes merged 2 commits into
mainfrom
203-pdo-pool-slot-configuration-changelog

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

Changelog for the acquire half of #203, landed in php-src true-async-stable (6d64baedf3).

A pooled slot carried no configuration contract: nothing was applied when it was created, and nothing when it was handed out.

  • Constructor options now reach the slots. pdo_pool_factory() called the driver with options = NULL, so every driver-specific option was dropped — silently turning a TLS-configured PDO into a plaintext one, and re-enabling ATTR_MULTI_STATEMENTS for users who had switched it off. This supersedes the stopgap refusal shipped in #201/#202/#203: pooled PDO crashes and unapplied driver options #209; that entry is removed from [Unreleased] since it never reached a release.
  • setAttribute() now reaches every slot. It was written onto whichever slot was bound at the time, so later slots kept their birth value. With ATTR_AUTOCOMMIT that lost data.
  • inTransaction() no longer takes a slot.
  • ATTR_POOL_MIN works at all — the pool pre-warms inside its own constructor, before the template is attached, so the warm-up always failed silently.

Bumps PDO_DRIVER_API for the two new pdo_dbh_t fields.

Verification

Reproduced each defect first, then checked each fix by reverting it:

  • TLS: with a deliberately unusable CA, direct refuses and pooled used to connect with an empty Ssl_cipher. Both now refuse identically.
  • ATTR_MULTI_STATEMENTS => false: honoured in pooled mode, matching direct.
  • ATTR_AUTOCOMMIT: 4 coroutines used to report autocommit=1 on 3 of 4 slots and leak rows past rollBack(); now 0,0,0,0 and no rows survive.
  • POOL_MIN: 0/1/3/5 produced count=0 for every value; now matches.
  • inTransaction(): used to move active 0 → 1 for a call answering "no transaction".

Four new tests (pdo_pool_024, pool_012, pool_014, pool_015), each confirmed to fail on the pre-fix binary.

Full local suite (24574 tests): 13 failures, none in PDO — same set as the pre-change baseline.

Not in this PR

The release half of #203 stays open: resetting session state on release (COM_RESET_CONNECTION / DISCARD ALL) and rolling back transactions opened with raw SQL, which needs in_transaction() rather than PDO's own flag. That work must follow this one — a reset before re-application would undo the attributes this PR restores.

Constructor options (incl. TLS) now reach pooled connections, setAttribute()
reaches every slot, inTransaction() no longer takes one, and ATTR_POOL_MIN
works. Supersedes the stopgap 'reject driver-specific options' entry, which
never shipped in a release.

php-src: true-async-stable 6d64baedf3
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The test created a pool with POOL_MIN => 2 and expected zero connections,
which is what the pool produced while the pre-warm was broken: it ran inside
the pool constructor, before the PDO template the factory builds from was
attached, so it silently created nothing. With the warm-up fixed the pool
holds the 2 connections that were asked for.

The assertion the test exists for -- closing a pool with a live healthcheck
timer without crashing -- is unchanged.
@EdmondDantes
EdmondDantes merged commit 6a2d179 into main Jul 23, 2026
9 checks passed
@EdmondDantes
EdmondDantes deleted the 203-pdo-pool-slot-configuration-changelog branch July 23, 2026 12:52
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.

1 participant