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

Id Generators are not compatible with PrimaryReadConnection anymore in 2.10 #9225

Closed
stof opened this issue Dec 3, 2021 · 3 comments
Closed
Milestone

Comments

@stof
Copy link
Member

stof commented Dec 3, 2021

BC Break Report

Q A
BC Break yes
Version 2.10.2

Summary

The ID generators are not using executeQuery() instead of query. But executeQuery does not guarantee that the primary connection is used (on purpose) and the id is generated on persist, so before starting the flush transaction. See https://github.com/doctrine/dbal/blob/141daa53e4f717a9ca234182b81179f9d1a573d5/src/Connections/PrimaryReadReplicaConnection.php#L36-L56

Previous behavior

In 2.9 and older, the id generators (I'm using the SequenceGenerator in my case) were using query() and so were automatically switching to the primary

Current behavior

Reading the next val of the sequence is done on the read replica, which fails as that action cannot be performed with read-only priviledges.

How to reproduce

@stof
Copy link
Member Author

stof commented Dec 3, 2021

@derrabus derrabus added this to the 2.10.4 milestone Dec 3, 2021
@derrabus
Copy link
Member

derrabus commented Dec 3, 2021

Would you be able to work on a fix?

@derrabus
Copy link
Member

Fixed by #9239

@derrabus derrabus removed the Bug label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants