Description
Symfony version(s) affected: 4.4
Description
Hi,
We are migrating to Messenger in our app progressively, and we just encountered an issue with the Doctrine Transport and our Doctrine configuration that uses a MasterSlaveConnection.
In the Doctrine transport Connection send
method, you use a executeQuery
on the statement.
As described in the PHPDoc of the MasterSlaveConnection, if the master DB was not picked before and an executeQuery
is executed, the connection will pick one of the slave instances.
The problem is that these slave instances are generally read-only, so the insert you are trying to make cannot work properly.
How to reproduce
- MasterSlaveConnection with Doctrine and read-only slaves
Possible Solution
The most straightforward solution for this problem would be to use another method to execute the query, that would guarantee the usage of the master instance in the MasterSlaveConnection.
I would propose to use the executeUpdate
method as it is also used in the insert
method of the Connection object.