Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] [Doctrine Transport] Problem handling a MasterSlaveConnection object #37355

Copy link
Copy link
Closed
@TristanPouliquen

Description

@TristanPouliquen
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.