Skip to content

Loading…

DBAL-507: [GH-313] Enhanced Master-Slave Connection #1711

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user @doctrinebot:

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

Url: #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.

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-313] was closed:
#313

@doctrinebot

Issue was closed with resolution "Won't Fix"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.