Bug #20782 | mysqladmin, ping command, small logic mistake | ||
---|---|---|---|
Submitted: | 29 Jun 2006 17:47 | Modified: | 30 Jul 2006 13:10 |
Reporter: | Kai Voigt | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.1.7-beta-log | OS: | MacOS (MacOSX 10.4) |
Assigned to: | CPU Architecture: | Any |
[29 Jun 2006 17:47]
Kai Voigt
[29 Jun 2006 18:01]
Kai Voigt
Cut'n'paste mistake on my side. Here's the fix for mysqladmin.cc *** mysqladmin.cc.orig Thu May 4 14:14:43 2006 --- mysqladmin.cc Thu May 4 14:15:36 2006 *************** *** 952,963 **** mysql->reconnect=1; if (!mysql_ping(mysql)) puts("connection was down, but mysqld is now alive"); ! } ! else ! { ! my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'", ! MYF(ME_BELL),mysql_error(mysql)); ! return -1; } } mysql->reconnect=1; /* Automatic reconnect is default */ --- 952,963 ---- mysql->reconnect=1; if (!mysql_ping(mysql)) puts("connection was down, but mysqld is now alive"); ! else ! { ! my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'", ! MYF(ME_BELL),mysql_error(mysql)); ! return -1; ! } } } mysql->reconnect=1; /* Automatic reconnect is default */
[30 Jun 2006 13:10]
Valeriy Kravchuk
Thank you for a problem report. For patches, please, use the latest -BK source (or, at least, the latest version released, 5.1.11). I do not agree with you point, though: > I believe this is wrong, because this way the "doesn't answer" branch will never > be reached. It should go like this: In this code: if (!mysql_ping(mysql)) { if (option_silent < 2) puts("mysqld is alive"); } else { if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) { mysql->reconnect=1; if (!mysql_ping(mysql)) puts("connection was down, but mysqld is now alive"); } else { my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'", MYF(ME_BELL),mysql_error(mysql)); return -1; } } mysql->reconnect=1; /* Automatic reconnect is default */ if mysql_ping returns CR_SERVER_GONE_ERROR, we ping it for a second time, and in case of ANY failure prints nothing. In case of any other error for the first mysql_ping, we print it. So, why do you think "mysqld doesn't answer to ping, error" wiil never be reached? There are two other possible errors, according to http://dev.mysql.com/doc/refman/5.1/en/mysql-ping.html. With your change in place you'll never be informed about any of two other error codes (like CR_COMMANDS_OUT_OF_SYNC) for the initail connection! And this is important. So, I am not sure your patch should be applied.
[30 Jul 2006 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".