Skip to content
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

Make PrimaryReadReplicaConnection enforcement explicit #9239

Merged
merged 3 commits into from
Dec 20, 2021

Conversation

beberlei
Copy link
Member

@beberlei beberlei commented Dec 11, 2021

Due a breaking API change with assumptions of PrimaryReadReplicaConnection in DBAL 3 without the distinction of query and executeStatement it is required to address the use of primary replica connection more explicitly in ORM.

This isn't the most pretty solution, but it detects the use of primary replica connection at the right points: 1. id generation 2. commit 3. DQL update/delete statements.

@derrabus derrabus requested a review from stof December 11, 2021 16:11
@beberlei
Copy link
Member Author

Just realized the primary also needs to be enforced when select statements are made with lock levels. This was a flaw previously too

@beberlei
Copy link
Member Author

Actually, PrimaryReadReplicaConnection::beginTransaction switches to the primary and wrapInTransaction (and transactional) as well as any call using a pessimistic lock start or require an open transaction. The only benefit would be to make this more explicit.

@stof
Copy link
Member

stof commented Dec 13, 2021

@beberlei should be done in 2.10.x IMO

@beberlei beberlei force-pushed the PrimaryReplicaExplicit branch from 9fb5e61 to de28ed2 Compare December 17, 2021 00:33
@beberlei beberlei changed the base branch from 2.11.x to 2.10.x December 17, 2021 00:33
@beberlei beberlei force-pushed the PrimaryReplicaExplicit branch from de28ed2 to fe2881c Compare December 17, 2021 00:37
@beberlei beberlei requested a review from stof December 17, 2021 00:37
@beberlei beberlei added this to the 2.10.4 milestone Dec 17, 2021
@derrabus derrabus changed the title Make PrimaryReadReplicaConnection enforcement explicit. Make PrimaryReadReplicaConnection enforcement explicit Dec 20, 2021
@derrabus derrabus merged commit 18138d8 into doctrine:2.10.x Dec 20, 2021
derrabus added a commit to derrabus/orm that referenced this pull request Dec 26, 2021
* 2.11.x:
  Enable UnusedUse sniff again (doctrine#9267)
  Whitelist composer plugins used by this repository (doctrine#9286)
  Fix XML export for `change-tracking-policy` (doctrine#9285)
  Allow symfony/cache 6 (doctrine#9283)
  Put actual value instead of index inside $originalEntityData. (doctrine#9244)
  Fix return types of cache interfaces (doctrine#9271)
  Better explain limitations of DQL "DELETE" (doctrine#9281)
  Fix docblocks on nullable EM properties (doctrine#9273)
  Docs: use canonical order for phpdoc tags, add missed semicolon (doctrine#9190)
  Make PrimaryReadReplicaConnection enforcement explicit (doctrine#9239)
  Regenerate Psalm baseline (doctrine#9272)
  Improve compatibility with Doctrine DBAL 4 (doctrine#9266)
  [docs] Fix wording for attributes=>parameters. (doctrine#9265)
  Support for nesting attributes with PHP 8.1 (doctrine#9241)
  Revert "Fix SchemaValidator with abstract child class in discriminator map (doctrine#9096)" (doctrine#9262)
  Docs: consistency for FQCN, spacing, etc (doctrine#9232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants