From c5e702f82463bbc87f6ccc4abc2a3f38795b2f66 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Wed, 14 Dec 2011 14:07:05 +0000 Subject: [PATCH] Brief description of the new constants related to mysqlnd_ms_set_qos() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321011 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqlnd_ms/concepts.xml | 5 +- reference/mysqlnd_ms/constants.xml | 83 ++++++++++++++++++- .../functions/mysqlnd-ms-set-qos.xml | 2 +- reference/mysqlnd_ms/quickstart.xml | 10 ++- 4 files changed, 93 insertions(+), 7 deletions(-) diff --git a/reference/mysqlnd_ms/concepts.xml b/reference/mysqlnd_ms/concepts.xml index 3ea118941a..9b5bcd1857 100755 --- a/reference/mysqlnd_ms/concepts.xml +++ b/reference/mysqlnd_ms/concepts.xml @@ -966,6 +966,8 @@ version = 5.6.2-m5-log Version requirement Service levels have been introduced in mysqlnd_ms version 1.2.0-alpha. + mysqlnd_ms_set_qos + requires PHP 5.4.0 or newer. @@ -988,7 +990,8 @@ version = 5.6.2-m5-log Service levels can be set through the qualify-of-service filter in the plugins configuration file - and at runtime using the function mysqlnd_ms_set_qos(). + and at runtime using the function + mysqlnd_ms_set_qos. The plugin defines the different service levels as follows. diff --git a/reference/mysqlnd_ms/constants.xml b/reference/mysqlnd_ms/constants.xml index c671b78ad4..988e69a0c6 100755 --- a/reference/mysqlnd_ms/constants.xml +++ b/reference/mysqlnd_ms/constants.xml @@ -12,7 +12,7 @@ The mysqlnd replication and load balancing plugin (mysqlnd_ms) - performs read/write splitting. This directs write queries to a MySQL + performs read/write splitting. This directs write queries to a MySQL master server, and read-only queries to the MySQL slave servers. The plugin has a built-in read/write split logic. All queries which start with SELECT are considered read-only @@ -104,7 +104,8 @@ slave_query = /*ms=slave*/SHOW TABLES - mysqlnd_ms_is_select related + mysqlnd_ms_query_is_select + related @@ -153,6 +154,84 @@ slave_query = /*ms=slave*/SHOW TABLES + + mysqlnd_ms_set_qos, + quality of service filter and service level related + + + + + + MYSQLND_MS_QOS_CONSISTENCY_EVENTUAL + (integer) + + + + Use to request the service level eventual consistency from the + mysqlnd_ms_set_qos. Eventual consistency is the + default quality of service when reading from an asynchronous MySQL + replication slave. Data returned in this service level may or may not + be stale, depending on whether the selected slaves happens to have replicated + the lastest changes from the MySQL replication master or not. + + + + + + MYSQLND_MS_QOS_CONSISTENCY_SESSION + (integer) + + + + Use to request the service level session consistency from the + mysqlnd_ms_set_qos. Session consistency + is defined as read your writes. The client is guaranteed to see his + latest changes. + + + + + + MYSQLND_MS_QOS_CONSISTENCY_STRONG + (integer) + + + + Use to request the service level strong consistency from the + mysqlnd_ms_set_qos. Strong consistency + is used to ensure all clients see each others changes. + + + + + + MYSQLND_MS_QOS_OPTION_GTID + (integer) + + + + Used as a service level option with + mysqlnd_ms_set_qos to parameterize session + consistency. + + + + + + MYSQLND_MS_QOS_OPTION_AGE + (integer) + + + + Used as a service level option with + mysqlnd_ms_set_qos to parameterize eventual + consistency. + + + + + + Other diff --git a/reference/mysqlnd_ms/functions/mysqlnd-ms-set-qos.xml b/reference/mysqlnd_ms/functions/mysqlnd-ms-set-qos.xml index de3b17531c..7c52978b40 100644 --- a/reference/mysqlnd_ms/functions/mysqlnd-ms-set-qos.xml +++ b/reference/mysqlnd_ms/functions/mysqlnd-ms-set-qos.xml @@ -108,7 +108,7 @@ which SHOW SLAVE STATUS reports Slave_IO_Running=Yes, Slave_SQL_Running=Yes and - Seconds_Behind_Master <option_value. Please note, + Seconds_Behind_Master <= option_value. Please note, searching appropriate slaves is an expensive and slow operation. Use the feature sparsely in version 1.2.0. Future versions may improve the algorithm used to identify candidates. Please, see the MySQL reference diff --git a/reference/mysqlnd_ms/quickstart.xml b/reference/mysqlnd_ms/quickstart.xml index 39e61ebfc5..db6031cd11 100755 --- a/reference/mysqlnd_ms/quickstart.xml +++ b/reference/mysqlnd_ms/quickstart.xml @@ -783,6 +783,8 @@ $mysqli->close(); Version requirement Service levels have been introduced in mysqlnd_ms version 1.2.0-alpha. + mysqlnd_ms_set_qos + is available with PHP 5.4.0 or newer. @@ -871,7 +873,8 @@ if (!$res = $mysqli->query("SELECT item, price FROM specials")) Service levels can be set in the plugins configuration file and at runtime - using mysqlnd_ms_set_qos(). In the example the function is used to enforce + using mysqlnd_ms_set_qos. + In the example the function is used to enforce session consistency (read your writes) for all future statements until further notice. The SELECT statement on the orders table is run on the master to ensure the previous write can be seen by the client. @@ -1088,7 +1091,7 @@ PHP Warning: mysqli::query(): (mysqlnd_ms) No connection selected by the last f the change already. Read load is taken away from the master. - Client-side global transaction ID injection has some limitations. Please, + Client-side global transaction ID emulation has some limitations. Please, read the concepts section carefully to fully understand the principles and ideas behind it, before using in production environments. The background knowledge @@ -1378,7 +1381,8 @@ var_dump($res->fetch_assoc()); A GTID returned from mysqlnd_ms_get_last_gtid() can be used as an option for the session consistency service level. Session consistency delivers read your writes. Session consistency can - be requested by calling mysqlnd_ms_set_qos(). + be requested by calling + mysqlnd_ms_set_qos. In the example, the plugin will execute the SELECT statement either on the master or on a slave which has replicated the previous INSERT already.