Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-309

MasterSlaveConnection with mysql "charset: "UTF8" forces use of master

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      mysql

      Description

      In a mysql master/slave environment with "charset:" set to "UTF8" an Event "postConnect" is dispatched after establishing the connection.

      MysqlSessionInit->postConnect() uses MasterSlaveConnection->executeUpdate() to submit this information to the current connection. executeUpdate() always connects to the master and the slaves won't be used (as documentated: "3. If master was picked once during the lifetime of the connection it will always get picked afterwards.").

      We suggest to use executeQuery() in postConnect() instead.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        MysqlInitListener is deprecated, because SET NAMES UTF8 is not a safe operation. Use the "charset" option of the PDO MySQL driver instead.

        Show
        Benjamin Eberlei added a comment - MysqlInitListener is deprecated, because SET NAMES UTF8 is not a safe operation. Use the "charset" option of the PDO MySQL driver instead.
        Hide
        Christophe Coevoet added a comment -

        Then we need to fix DoctrineBundle to stop using the init listener for mysql.

        Show
        Christophe Coevoet added a comment - Then we need to fix DoctrineBundle to stop using the init listener for mysql.
        Hide
        Daniel Sippel added a comment - - edited

        I agree with Christophe and reopened this issue.

        Show
        Daniel Sippel added a comment - - edited I agree with Christophe and reopened this issue.
        Hide
        Christophe Coevoet added a comment -

        Please close the issue Benjamin. This has been fixed in DoctrineBundle: https://github.com/doctrine/DoctrineBundle/pull/111
        I don't have enough rights in JIRA to close it myself.

        Show
        Christophe Coevoet added a comment - Please close the issue Benjamin. This has been fixed in DoctrineBundle: https://github.com/doctrine/DoctrineBundle/pull/111 I don't have enough rights in JIRA to close it myself.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Daniel Sippel
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: