From be11f1a0d1684c598bf987a675910a8c4dc3534e Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Fri, 23 Sep 2011 11:42:04 +0000 Subject: [PATCH] Coverage for new 1.1.0 statistics and changes/BC breaks between 1.0.x alpha - 1.1.0 beta git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@317190 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mysqlnd_ms/changes.xml | 19 ++- .../functions/mysqlnd-ms-get-stats.xml | 118 +++++++++++++++--- 2 files changed, 119 insertions(+), 18 deletions(-) diff --git a/reference/mysqlnd_ms/changes.xml b/reference/mysqlnd_ms/changes.xml index e1c2b1f714..61befdc33c 100644 --- a/reference/mysqlnd_ms/changes.xml +++ b/reference/mysqlnd_ms/changes.xml @@ -52,7 +52,8 @@ BC break: mysqlnd_ms_set_user_pick_server has been removed. The user filter has been introduced to replace it. - The filter offers almost the same functionality, see below for details. + The filter offers almost the same functionality, see below for a + discussion of differences. @@ -73,6 +74,22 @@ Support for (native) prepared statements. + + + New statistics: use_master_guess, + use_slave_guess. + + + + BC break: Semantics of statistics changed for + use_slave, use_master. + Future changes are likely. Please see, + mysqlnd_ms_get_stats. + + + + + diff --git a/reference/mysqlnd_ms/functions/mysqlnd-ms-get-stats.xml b/reference/mysqlnd_ms/functions/mysqlnd-ms-get-stats.xml index 16b86c7e5a..81c80e557e 100755 --- a/reference/mysqlnd_ms/functions/mysqlnd-ms-get-stats.xml +++ b/reference/mysqlnd_ms/functions/mysqlnd-ms-get-stats.xml @@ -74,12 +74,34 @@ use_slave - Number of statements considered as read-only by the built-in query analyzer. - Neither statements which begin with a SQL hint to force - use of slave nor statements directed to a slave by an user-defined - callback are included. The total number of statements sent to the slaves is - use_slave + use_slave_sql_hint + - use_slave_callback. + + The semantics of this statistic has changed between 1.0.1 - 1.1.0. + + + The meaning for version 1.0.1 is as follows. + Number of statements considered as read-only by the built-in query analyzer. + Neither statements which begin with a SQL hint to force + use of slave nor statements directed to a slave by an user-defined + callback are included. The total number of statements sent to the slaves is + use_slave + use_slave_sql_hint + + use_slave_callback. + + + PECL/mysqlnd_ms 1.1.0 introduces a new concept of chained filters. The + statictics is now set by the internal load balancing filter. With + version 1.1.0 the load balancing filter is always the last in the + filter chain, if used. In future versions a load balancing filter may be + followed by other filters causing another change in the meaning of + the statistic. If, in the future, a load balancing filter is followed + by another filter it is no longer guaranteed that the satement, whichs + increments use_slave, will be executed on the slaves. + + + The meaning for version 1.1.0 is as follows. Number of statements + sent to the slaves. Statements directed to a slave by the user filter + (an user-defined callback) are not included. The latter are counted by + use_slave_callback. + Since 1.0.0. @@ -88,15 +110,67 @@ use_master - Number of statements not considered as read-only by the built-in query analyzer. - Neither statements which begin with a SQL hint to force - use of master nor statements directed to a master by an user-defined - callback are included. The total number of statements sent to the master is - use_master + use_master_sql_hint + - use_master_callback. + + The semantics of this statistic has changed between 1.0.1 - 1.1.0. + + + The meaning for version 1.0.1 is as follows. + Number of statements not considered as read-only by the built-in query analyzer. + Neither statements which begin with a SQL hint to force + use of master nor statements directed to a master by an user-defined + callback are included. The total number of statements sent to the master is + use_master + use_master_sql_hint + + use_master_callback. + + + PECL/mysqlnd_ms 1.1.0 introduces a new concept of chained filters. The + statictics is now set by the internal load balancing filter. With + version 1.1.0 the load balancing filter is always the last in the + filter chain, if used. In future versions a load balancing filter may be + followed by other filters causing another change in the meaning of + the statistic. If, in the future, a load balancing filter is followed + by another filter it is no longer guaranteed that the satement, whichs + increments use_master, will be executed on the slaves. + + + The meaning for version 1.1.0 is as follows. Number of statements + sent to the masters. Statements directed to a master by the user filter + (an user-defined callback) are not included. The latter are counted by + use_master_callback. + Since 1.0.0. + + + use_slave_guess + + + Number of statements the built-in query analyzer recommends sending to + a slave because they contain no SQL hint to force use of a + certain server. The recommendation may be overruled in the following. + It is not guaranteed whether the statement will be excuted on a slave + or not. This is how often the internal is_select + function has guessed that a slave shall be used. Please, see also the + user space function mysqlnd_ms_query_is_select. + + Since 1.1.0. + + + + use_master_guess + + + Number of statements the built-in query analyzer recommends sending to + a master because they contain no SQL hint to force use of a + certain server. The recommendation may be overruled in the following. + It is not guaranteed whether the statement will be excuted on a slave + or not. This is how often the internal is_select + function has guessed that a master shall be used. Please, see also the + user space function mysqlnd_ms_query_is_select. + + Since 1.1.0. + use_slave_sql_hint @@ -301,6 +375,7 @@ @@ -309,17 +384,26 @@ var_dump(mysqlnd_ms_get_stats()); &example.outputs; string(1) "0" ["use_master"]=> string(1) "0" - ["use_slave_forced"]=> + ["use_slave_guess"]=> string(1) "0" - ["use_master_forced"]=> + ["use_master_guess"]=> string(1) "0" - ["use_last_used_forced"]=> + ["use_slave_sql_hint"]=> + string(1) "0" + ["use_master_sql_hint"]=> + string(1) "0" + ["use_last_used_sql_hint"]=> + string(1) "0" + ["use_slave_callback"]=> + string(1) "0" + ["use_master_callback"]=> string(1) "0" ["non_lazy_connections_slave_success"]=> string(1) "0"