Commit 63c7276f authored by unknown's avatar unknown

Fix for 'mysqladmin -w1 unknown-command'

Manual Changelog update


Docs/manual.texi:
  Changelog
client/mysqladmin.c:
  Fix for 'mysqladmin -w1 unknown-command'
libmysql/violite.c:
  Fix for TCP_NODELAY
mysql-test/mysql-test-run.sh:
  Portability fixes
sql/sql_lex.cc:
  Cleanup
sql/sql_lex.h:
  Cleanup
parent 9def7003
...@@ -46793,6 +46793,7 @@ users use this code as the rest of the code and because of this we are ...@@ -46793,6 +46793,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code. not yet 100% confident in this code.
@menu @menu
* News-3.23.44:: Changes in release 3.23.44
* News-3.23.43:: Changes in release 3.23.43 * News-3.23.43:: Changes in release 3.23.43
* News-3.23.42:: Changes in release 3.23.42 * News-3.23.42:: Changes in release 3.23.42
* News-3.23.41:: Changes in release 3.23.41 * News-3.23.41:: Changes in release 3.23.41
...@@ -46840,7 +46841,17 @@ not yet 100% confident in this code. ...@@ -46840,7 +46841,17 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@node News-3.23.43, News-3.23.42, News-3.23.x, News-3.23.x @node News-3.23.44, News-3.23.43, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.44
@itemize @bullet
@item
When using replications, aborted queries that contained @code{%} could cause
a core dum.
@item
TCP_NODELAY was not used on some systems. (Speed problem).
@end itemize
@node News-3.23.43, News-3.23.42, News-3.23.44, News-3.23.x
@appendixsubsec Changes in release 3.23.43 @appendixsubsec Changes in release 3.23.43
@itemize @bullet @itemize @bullet
@item @item
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#define ADMIN_VERSION "8.21" #define ADMIN_VERSION "8.22"
#define MAX_MYSQL_VAR 64 #define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
...@@ -51,7 +51,7 @@ static void print_version(void); ...@@ -51,7 +51,7 @@ static void print_version(void);
static void usage(void); static void usage(void);
static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user, static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user,
const char *password,uint wait); const char *password,uint wait);
static my_bool execute_commands(MYSQL *mysql,int argc, char **argv); static int execute_commands(MYSQL *mysql,int argc, char **argv);
static int drop_db(MYSQL *mysql,const char *db); static int drop_db(MYSQL *mysql,const char *db);
static sig_handler endprog(int signal_number); static sig_handler endprog(int signal_number);
static void nice_time(ulong sec,char *buff); static void nice_time(ulong sec,char *buff);
...@@ -275,16 +275,24 @@ int main(int argc,char *argv[]) ...@@ -275,16 +275,24 @@ int main(int argc,char *argv[])
while (!interrupted) while (!interrupted)
{ {
new_line = 0; new_line = 0;
if (execute_commands(&mysql,argc,commands) && !option_force) if ((error=execute_commands(&mysql,argc,commands)))
{ {
if (option_wait && !interrupted) if (error > 0)
break; /* Wrong command error */
if (!option_force)
{ {
mysql_close(&mysql); if (option_wait && !interrupted)
if (!sql_connect(&mysql,host,user,opt_password,option_wait)) {
continue; /* Retry */ mysql_close(&mysql);
if (!sql_connect(&mysql,host,user,opt_password,option_wait))
{
sleep(1); /* Don't retry too rapidly */
continue; /* Retry */
}
}
error=1;
break;
} }
error=1;
break;
} }
if (interval) if (interval)
{ {
...@@ -301,7 +309,7 @@ int main(int argc,char *argv[]) ...@@ -301,7 +309,7 @@ int main(int argc,char *argv[])
my_free(user,MYF(MY_ALLOW_ZERO_PTR)); my_free(user,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv); free_defaults(argv);
my_end(0); my_end(0);
exit(error); exit(error ? 1 : 0);
return 0; return 0;
} }
...@@ -383,8 +391,14 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -383,8 +391,14 @@ static my_bool sql_connect(MYSQL *mysql,const char *host, const char *user,
} }
} }
/*
Execute a command.
Return 0 on ok
-1 on retryable error
1 on fatal error
*/
static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
char *status; char *status;
...@@ -404,7 +418,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -404,7 +418,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'", my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'",
MYF(ME_BELL), mysql_error(mysql)); MYF(ME_BELL), mysql_error(mysql));
return 1; return -1;
} }
argc--; argv++; argc--; argv++;
break; break;
...@@ -417,7 +431,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -417,7 +431,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
return 1; return 1;
} }
if (drop_db(mysql,argv[1])) if (drop_db(mysql,argv[1]))
return 1; return -1;
argc--; argv++; argc--; argv++;
break; break;
} }
...@@ -433,7 +447,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -433,7 +447,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"shutdown failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"shutdown failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
mysql_close(mysql); /* Close connection to avoid error messages */ mysql_close(mysql); /* Close connection to avoid error messages */
if (got_pidfile) if (got_pidfile)
...@@ -450,7 +464,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -450,7 +464,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
case ADMIN_REFRESH: case ADMIN_REFRESH:
...@@ -461,7 +475,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -461,7 +475,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
case ADMIN_FLUSH_THREADS: case ADMIN_FLUSH_THREADS:
...@@ -469,7 +483,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -469,7 +483,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
case ADMIN_VER: case ADMIN_VER:
...@@ -513,7 +527,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -513,7 +527,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
print_header(result); print_header(result);
while ((row=mysql_fetch_row(result))) while ((row=mysql_fetch_row(result)))
...@@ -552,7 +566,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -552,7 +566,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
} }
argc--; argv++; argc--; argv++;
if (error) if (error)
return error; return -1;
break; break;
} }
case ADMIN_DEBUG: case ADMIN_DEBUG:
...@@ -560,7 +574,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -560,7 +574,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"debug failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"debug failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
case ADMIN_VARIABLES: case ADMIN_VARIABLES:
...@@ -574,7 +588,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -574,7 +588,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"unable to show variables; error: '%s'",MYF(ME_BELL), my_printf_error(0,"unable to show variables; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
print_header(res); print_header(res);
while ((row=mysql_fetch_row(res))) while ((row=mysql_fetch_row(res)))
...@@ -596,7 +610,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -596,7 +610,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0, "unable to show status; error: '%s'", MYF(ME_BELL), my_printf_error(0, "unable to show status; error: '%s'", MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
if (!opt_vertical) if (!opt_vertical)
print_header(res); print_header(res);
...@@ -646,7 +660,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -646,7 +660,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
} }
...@@ -656,7 +670,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -656,7 +670,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
} }
...@@ -666,7 +680,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -666,7 +680,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
} }
...@@ -676,7 +690,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -676,7 +690,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
break; break;
} }
...@@ -684,7 +698,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -684,7 +698,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
char buff[128],crypted_pw[33]; char buff[128],crypted_pw[33];
if(argc < 2) if (argc < 2)
{ {
my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL)); my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL));
return 1; return 1;
...@@ -699,13 +713,13 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -699,13 +713,13 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0, "Can't turn off logging; error: '%s'", my_printf_error(0, "Can't turn off logging; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); MYF(ME_BELL),mysql_error(mysql));
return 1; return -1;
} }
if (mysql_query(mysql,buff)) if (mysql_query(mysql,buff))
{ {
my_printf_error(0,"unable to change password; error: '%s'", my_printf_error(0,"unable to change password; error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); MYF(ME_BELL),mysql_error(mysql));
return 1; return -1;
} }
argc--; argv++; argc--; argv++;
break; break;
...@@ -716,7 +730,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -716,7 +730,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL), my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
else else
puts("Slave started"); puts("Slave started");
...@@ -726,7 +740,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -726,7 +740,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL), my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));
return 1; return -1;
} }
else else
puts("Slave stopped"); puts("Slave stopped");
...@@ -751,7 +765,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -751,7 +765,7 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'", my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'",
MYF(ME_BELL),mysql_error(mysql)); MYF(ME_BELL),mysql_error(mysql));
return 1; return -1;
} }
} }
mysql->reconnect=1; /* Automatic reconnect is default */ mysql->reconnect=1; /* Automatic reconnect is default */
......
...@@ -39,6 +39,13 @@ ...@@ -39,6 +39,13 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__)
#include <netinet/ip.h>
#if !defined(alpha_linux_port)
#include <netinet/tcp.h>
#endif
#endif
#if defined(__EMX__) || defined(OS2) #if defined(__EMX__) || defined(OS2)
#define ioctlsocket ioctl #define ioctlsocket ioctl
#endif /* defined(__EMX__) */ #endif /* defined(__EMX__) */
......
...@@ -273,8 +273,7 @@ DASH72=`$ECHO '----------------------------------------------------------------- ...@@ -273,8 +273,7 @@ DASH72=`$ECHO '-----------------------------------------------------------------
# on binary, use what is installed # on binary, use what is installed
if [ x$SOURCE_DIST = x1 ] ; then if [ x$SOURCE_DIST = x1 ] ; then
MYSQLD="$BASEDIR/sql/mysqld" MYSQLD="$BASEDIR/sql/mysqld"
if [ -e "$BASEDIR/client/.libs/mysqltest" ] ; then if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
[ -e "$BASEDIR/client/.libs/lt-mysqltest" ] || $BASEDIR/client/mysqltest -V
MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest" MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
else else
MYSQL_TEST="$BASEDIR/client/mysqltest" MYSQL_TEST="$BASEDIR/client/mysqltest"
...@@ -350,7 +349,7 @@ prompt_user () ...@@ -350,7 +349,7 @@ prompt_user ()
read unused read unused
} }
# We can't use diff -u as this isn't portable # We can't use diff -u or diff -a as these are not portable
show_failed_diff () show_failed_diff ()
{ {
...@@ -367,7 +366,7 @@ show_failed_diff () ...@@ -367,7 +366,7 @@ show_failed_diff ()
then then
echo "Below are the diffs between actual and expected results:" echo "Below are the diffs between actual and expected results:"
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
$DIFF -c -a $result_file $reject_file $DIFF -c $result_file $reject_file
echo "-------------------------------------------------------" echo "-------------------------------------------------------"
echo "Please follow the instructions outlined at" echo "Please follow the instructions outlined at"
echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html" echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html"
......
...@@ -147,7 +147,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) ...@@ -147,7 +147,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->in_sum_expr=0; lex->in_sum_expr=0;
lex->expr_list.empty(); lex->expr_list.empty();
lex->ftfunc_list.empty(); lex->ftfunc_list.empty();
lex->convert_set=(lex->thd=thd)->convert_set; lex->convert_set=thd->convert_set;
lex->yacc_yyss=lex->yacc_yyvs=0; lex->yacc_yyss=lex->yacc_yyvs=0;
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
return lex; return lex;
......
...@@ -129,7 +129,6 @@ typedef struct st_lex { ...@@ -129,7 +129,6 @@ typedef struct st_lex {
CONVERT *convert_set; CONVERT *convert_set;
LEX_USER *grant_user; LEX_USER *grant_user;
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd;
udf_func udf; udf_func udf;
HA_CHECK_OPT check_opt; // check/repair options HA_CHECK_OPT check_opt; // check/repair options
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment