Commit 42f6fd5f authored by unknown's avatar unknown

Added some missing DBUG_RETURN

Fixed that --valgrind works again with mysql-test-run.sh
Extended error messages when loosing connection during mysql_real_connect()


client/mysqldump.c:
  Added some missing DBUG_RETURN
include/errmsg.h:
  Extended error messages when loosing connection during mysql_real_connect()
libmysql/errmsg.c:
  Extended error messages when loosing connection during mysql_real_connect()
mysql-test/mysql-test-run.pl:
  Don't remove .reject files at startup
mysql-test/mysql-test-run.sh:
  Fixed that --valgrind works again
  Don't give warnings for directores in var/tmp
sql-common/client.c:
  Extended error messages when loosing connection during mysql_real_connect()
parent 88696530
...@@ -2203,7 +2203,7 @@ static void dump_table(char *table, char *db) ...@@ -2203,7 +2203,7 @@ static void dump_table(char *table, char *db)
The "table" could be a view. If so, we don't do anything here. The "table" could be a view. If so, we don't do anything here.
*/ */
if (strcmp (table_type, "VIEW") == 0) if (strcmp (table_type, "VIEW") == 0)
return; DBUG_VOID_RETURN;
/* Check --no-data flag */ /* Check --no-data flag */
if (opt_no_data) if (opt_no_data)
...@@ -2869,7 +2869,7 @@ static int dump_all_tables_in_db(char *database) ...@@ -2869,7 +2869,7 @@ static int dump_all_tables_in_db(char *database)
*afterdot++= '.'; *afterdot++= '.';
if (init_dumping(database, init_dumping_tables)) if (init_dumping(database, init_dumping_tables))
return 1; DBUG_RETURN(1);
if (opt_xml) if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables) if (lock_tables)
...@@ -2923,7 +2923,7 @@ static int dump_all_tables_in_db(char *database) ...@@ -2923,7 +2923,7 @@ static int dump_all_tables_in_db(char *database)
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n"); fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n"); fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n");
} }
return 0; DBUG_RETURN(0);
} /* dump_all_tables_in_db */ } /* dump_all_tables_in_db */
......
...@@ -97,6 +97,7 @@ extern const char *client_errors[]; /* Error messages */ ...@@ -97,6 +97,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NO_STMT_METADATA 2052 #define CR_NO_STMT_METADATA 2052
#define CR_NO_RESULT_SET 2053 #define CR_NO_RESULT_SET 2053
#define CR_NOT_IMPLEMENTED 2054 #define CR_NOT_IMPLEMENTED 2054
#define CR_ERROR_LAST /*Copy last error nr:*/ 2054 #define CR_SERVER_LOST_EXTENDED 2055
#define CR_ERROR_LAST /*Copy last error nr:*/ 2055
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ /* Add error numbers before CR_ERROR_LAST and change it accordingly. */
...@@ -82,6 +82,7 @@ const char *client_errors[]= ...@@ -82,6 +82,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata", "Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement", "Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet", "This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"" ""
}; };
...@@ -145,6 +146,7 @@ const char *client_errors[]= ...@@ -145,6 +146,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata", "Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement", "Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet", "This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"" ""
}; };
...@@ -206,6 +208,7 @@ const char *client_errors[]= ...@@ -206,6 +208,7 @@ const char *client_errors[]=
"Prepared statement contains no metadata", "Prepared statement contains no metadata",
"Attempt to read a row while there is no result set associated with the statement", "Attempt to read a row while there is no result set associated with the statement",
"This feature is not implemented yet", "This feature is not implemented yet",
"Lost connection to MySQL server at '%s', system error: %d",
"" ""
}; };
#endif #endif
......
...@@ -2047,7 +2047,7 @@ sub cleanup_stale_files () { ...@@ -2047,7 +2047,7 @@ sub cleanup_stale_files () {
} }
# Remove old log files # Remove old log files
foreach my $name (glob("r/*.reject r/*.progress r/*.log r/*.warnings")) foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
{ {
unlink($name); unlink($name);
} }
...@@ -2995,14 +2995,14 @@ sub find_testcase_skipped_reason($) ...@@ -2995,14 +2995,14 @@ sub find_testcase_skipped_reason($)
{ {
my ($tinfo)= @_; my ($tinfo)= @_;
# Open mysqltest.log # Open mysqltest-time
my $F= IO::File->new($path_timefile) or my $F= IO::File->new($path_timefile) or
mtr_error("can't open file \"$path_timefile\": $!"); mtr_error("can't open file \"$path_timefile\": $!");
my $reason; my $reason;
while ( my $line= <$F> ) while ( my $line= <$F> )
{ {
# Look for "reason: <reason fo skiping test>" # Look for "reason: <reason for skipping test>"
if ( $line =~ /reason: (.*)/ ) if ( $line =~ /reason: (.*)/ )
{ {
$reason= $1; $reason= $1;
......
...@@ -123,7 +123,7 @@ find_valgrind() ...@@ -123,7 +123,7 @@ find_valgrind()
fi fi
# >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck" valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$CWD/valgrind.supp" FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp"
} }
# No paths below as we can't be sure where the program is! # No paths below as we can't be sure where the program is!
...@@ -2087,7 +2087,7 @@ then ...@@ -2087,7 +2087,7 @@ then
# Remove files that can cause problems # Remove files that can cause problems
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster $RM -rf $MYSQL_TEST_DIR/var/ndbcluster
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* $RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
# Remove old berkeley db log files that can confuse the server # Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.* $RM -f $MASTER_MYDDIR/log.*
......
...@@ -753,6 +753,29 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate) ...@@ -753,6 +753,29 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static void set_mysql_extended_error(MYSQL *mysql, int errcode,
const char *sqlstate,
const char *format, ...)
{
NET *net;
va_list args;
DBUG_ENTER("set_mysql_extended_error");
DBUG_PRINT("enter", ("error :%d '%s'", errcode, format));
DBUG_ASSERT(mysql != 0);
net= &mysql->net;
net->last_errno= errcode;
va_start(args, format);
my_vsnprintf(net->last_error, sizeof(net->last_error)-1,
format, args);
va_end(args);
strmov(net->sqlstate, sqlstate);
DBUG_VOID_RETURN;
}
/* /*
Flush result set sent from server Flush result set sent from server
*/ */
...@@ -850,6 +873,7 @@ static int check_license(MYSQL *mysql) ...@@ -850,6 +873,7 @@ static int check_license(MYSQL *mysql)
void end_server(MYSQL *mysql) void end_server(MYSQL *mysql)
{ {
int save_errno= errno;
DBUG_ENTER("end_server"); DBUG_ENTER("end_server");
if (mysql->net.vio != 0) if (mysql->net.vio != 0)
{ {
...@@ -862,6 +886,7 @@ void end_server(MYSQL *mysql) ...@@ -862,6 +886,7 @@ void end_server(MYSQL *mysql)
} }
net_end(&mysql->net); net_end(&mysql->net);
free_old_query(mysql); free_old_query(mysql);
errno= save_errno;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -2031,7 +2056,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2031,7 +2056,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if (mysql->options.connect_timeout && if (mysql->options.connect_timeout &&
vio_poll_read(net->vio, mysql->options.connect_timeout)) vio_poll_read(net->vio, mysql->options.connect_timeout))
{ {
set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"waiting for initial communication packet",
errno);
goto error; goto error;
} }
...@@ -2040,8 +2068,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2040,8 +2068,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
*/ */
if ((pkt_length=cli_safe_read(mysql)) == packet_error) if ((pkt_length=cli_safe_read(mysql)) == packet_error)
{
if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"reading initial communication packet",
errno);
goto error; goto error;
}
/* Check if version of protocol matches current one */ /* Check if version of protocol matches current one */
mysql->protocol_version= net->read_pos[0]; mysql->protocol_version= net->read_pos[0];
...@@ -2175,7 +2209,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2175,7 +2209,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
*/ */
if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net)) if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net))
{ {
set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"sending connection information to server",
errno);
goto error; goto error;
} }
...@@ -2254,7 +2291,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2254,7 +2291,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Write authentication package */ /* Write authentication package */
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net)) if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
{ {
set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"sending authentication information",
errno);
goto error; goto error;
} }
...@@ -2264,7 +2304,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2264,7 +2304,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
*/ */
if ((pkt_length=cli_safe_read(mysql)) == packet_error) if ((pkt_length=cli_safe_read(mysql)) == packet_error)
{
if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"reading authorization packet",
errno);
goto error; goto error;
}
if (pkt_length == 1 && net->read_pos[0] == 254 && if (pkt_length == 1 && net->read_pos[0] == 254 &&
mysql->server_capabilities & CLIENT_SECURE_CONNECTION) mysql->server_capabilities & CLIENT_SECURE_CONNECTION)
...@@ -2276,13 +2323,23 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2276,13 +2323,23 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
scramble_323(buff, mysql->scramble, passwd); scramble_323(buff, mysql->scramble, passwd);
if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net)) if (my_net_write(net, buff, SCRAMBLE_LENGTH_323 + 1) || net_flush(net))
{ {
set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"sending password information",
errno);
goto error; goto error;
} }
/* Read what server thinks about out new auth message report */ /* Read what server thinks about out new auth message report */
if (cli_safe_read(mysql) == packet_error) if (cli_safe_read(mysql) == packet_error)
{
if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"reading final connect information",
errno);
goto error; goto error;
} }
}
if (client_flag & CLIENT_COMPRESS) /* We will use compression */ if (client_flag & CLIENT_COMPRESS) /* We will use compression */
net->compress=1; net->compress=1;
...@@ -2292,8 +2349,15 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2292,8 +2349,15 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto error; goto error;
#endif #endif
if (db && mysql_select_db(mysql,db)) if (db && mysql_select_db(mysql, db))
{
if (mysql->net.last_errno == CR_SERVER_LOST)
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
ER(CR_SERVER_LOST_EXTENDED),
"Setting intital database",
errno);
goto error; goto error;
}
if (mysql->options.init_commands) if (mysql->options.init_commands)
{ {
......
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