svn: /pecl/mysqlnd_ms/trunk/ mysqlnd_ms.c tests/mysqlnd_ms_settings_slave_unreachable.phpt
| From: | Ulf Wendel | Date: | Thu, 26 May 2011 13:43:02 +0000 |
| Subject: | svn: /pecl/mysqlnd_ms/trunk/ mysqlnd_ms.c tests/mysqlnd_ms_settings_slave_unreachable.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-15688@lists.php.net to get a copy of this message | ||
uw Thu, 26 May 2011 13:43:02 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=311442
Log:
Our error handling is sort of broken. Its impossible for users to retrieve proper error messages
from connections in the pool, at least impossible in case of connect failure. We should seriously
consider mysqlnd_ms_get_[connection]_error_info(). Warnings, if they appear at all, are no good
source.
Changed paths:
U pecl/mysqlnd_ms/trunk/mysqlnd_ms.c
U pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_settings_slave_unreachable.phpt
Modified: pecl/mysqlnd_ms/trunk/mysqlnd_ms.c
===================================================================
--- pecl/mysqlnd_ms/trunk/mysqlnd_ms.c 2011-05-26 13:22:41 UTC (rev 311441)
+++ pecl/mysqlnd_ms/trunk/mysqlnd_ms.c 2011-05-26 13:43:02 UTC (rev 311442)
@@ -724,7 +724,7 @@
if (FAIL == ret) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, MYSQLND_MS_ERROR_PREFIX " Error while
connecting to the master(s)");
if (!conn->error_info.error_no) {
- SET_CLIENT_ERROR(conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE,
+ SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
MYSQLND_MS_ERROR_PREFIX " Error while connecting to the master(s)");
}
break;
@@ -741,7 +741,7 @@
if (FAIL == ret) {
if (!conn->error_info.error_no) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, MYSQLND_MS_ERROR_PREFIX " Error while
connecting to the slaves");
- SET_CLIENT_ERROR(conn->error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE,
+ SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
MYSQLND_MS_ERROR_PREFIX " Error while connecting to the slaves");
}
break;
Modified: pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_settings_slave_unreachable.phpt
===================================================================
--- pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_settings_slave_unreachable.phpt 2011-05-26 13:22:41 UTC
(rev 311441)
+++ pecl/mysqlnd_ms/trunk/tests/mysqlnd_ms_settings_slave_unreachable.phpt 2011-05-26 13:43:02 UTC
(rev 311442)
@@ -48,8 +48,8 @@
printf("[002] Plugin has failed to connect but connect error is not set, [%d]
'%s'\n",
mysqli_connect_errno(), mysqli_connect_error());
} else {
- printf("[003] Plugin reports connect error, [%d] '%s'\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ die(sprintf("[003] Plugin reports connect error, [%d] '%s'\n",
+ mysqli_connect_errno(), mysqli_connect_error()));
}
} else {
printf("[004] Plugin returns valid handle, no API to fetch error codes, connect error: [%d]
'%s', error: [%d] '%s'\n",
@@ -105,7 +105,4 @@
printf("[clean] Cannot unlink ini file
'test_mysqlnd_ms_slave_unreachable.ini'.\n");
?>
--EXPECTF--
-[004] Plugin returns valid handle, no API to fetch error codes, connect error: [0] '',
error: [0] ''
-Slave %d has run 2 queries.
-Slave %d has run 1 queries.
-done!
+[003] Plugin reports connect error, [2000] '(mysqlnd_ms) Error while connecting to the
slaves'