Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2583
in a way that functions are added or removed. But their behaviour changes when using the plugin.
Existing applications do not need to be adapted to a new API, but they may need to be modified
because of the behaviour changes.
The plugin breaks the one-by-one relationship between a
mysqli
,
mysql
, and
PDO_MYSQL
connection
handle and a MySQL network connection. And a
mysqli
,
mysql
, and
PDO_MYSQL
connection handle
represents a local pool of connections to the configured MySQL replication master and MySQL
replication slave servers. The plugin redirects queries to the master and slave servers. At some point
in time one and the same PHP connection handle may point to the MySQL master server. Later on,
it may point to one of the slave servers or still the master. Manipulating and replacing the network
connection referenced by a PHP MySQL connection handle is not a transparent operation.
Every MySQL connection has a state. The state of the connections in the connection pool of the plugin
can differ. Whenever the plugin switches from one wire connection to another, the current state of the
user connection may change. The applications must be aware of this.
The following list shows what the connection state consists of. The list may not be complete.
• Transaction status
• Temporary tables
• Table locks
• Session system variables and session user variables
• The current database set using
USE
and other state chaining SQL commands
• Prepared statements
•
HANDLER
variables
• Locks acquired with
GET_LOCK()
Connection switches happen right before queries are executed. The plugin does not switch the current
connection until the next statement is executed.
Replication issues
See also the MySQL reference manual chapter about
replication features
and
related issues. Some restrictions may not be related to the PHP plugin, but are
properties of the MySQL replication system.
Broadcasted messages
The plugins philosophy is to align the state of connections in the pool only if the state is under full
control of the plugin, or if it is necessary for security reasons. Just a few actions that change the state
of the connection fall into this category.
The following is a list of connection client library calls that change state, and are broadcasted to all
open connections in the connection pool.
If any of the listed calls below are to be executed, the plugin loops over all open master and slave
connections. The loop continues until all servers have been contacted, and the loop does not break if
a server indicates a failure. If possible, the failure will propagate to the called user API function, which
may be detected depending on which underlying library function was triggered.
Library
call
Notes
Version
change_user()
Called by the
mysqli_change_user
user API call. Also triggered
upon reuse of a persistent
mysqli
connection.
Since 1.0.0.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...