Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-507

[GH-313] Enhanced Master-Slave Connection

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of andrejhudec:

      Url: https://github.com/doctrine/dbal/pull/313

      Message:

      Q A
      -------------
      Bug fix? no
      New feature? yes
      BC breaks? no?
      Deprecations? no
      Tests pass? yes
      Fixed tickets -
      License MIT

      Current implementation of MasterSlaveConnection is very restrictive. The slave is picked up only when `executeQuery` is used. If appliacation uses `prepare` method in queries, every `SELECT` is done on master and this is bad for performance of master.

      This PR changes how and when it picks the slave or master:

      1. Slave if master was never picked before and ONLY if `getWrappedConnection`, `query`, `prepare`, or `executeQuery` is used and the query begins with `SELECT` (case insensitive) string.

      2. Master picked when `exec`, `executeUpdate`, `insert`, `delete`, `update`, `createSavepoint`, `releaseSavepoint`, `beginTransaction`, `rollback`, `commit` is called.

      3. Master picked when `query`, `prepare` or `executeQuery` is called and the query doesn't begin with `SELECT` (case insensitive) string.

      4. If master was picked once during the lifetime of the connection it will always get picked afterwards.

      5. One slave connection is randomly picked ONCE during a request.

        Activity

        Doctrine Bot created issue -
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-313] was closed:
        https://github.com/doctrine/dbal/pull/313

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-313] was closed: https://github.com/doctrine/dbal/pull/313
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-507, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: