Rename "shutdown" -> "send_shutdown" and "kill_server" to "shutdown_server"
Fix warnings mysql-test/mysql-test-run.pl: Symlink var/tmp to $opt_tmpdir if not using var/tmp mysql-test/include/restart_mysqld.inc: Renama
This commit is contained in:
parent
4638c78d35
commit
857a6dc14c
@ -268,7 +268,7 @@ enum enum_commands {
|
|||||||
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
|
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
|
||||||
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
|
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
|
||||||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
||||||
Q_SHUTDOWN, Q_KILL_SERVER,
|
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
|
||||||
|
|
||||||
Q_UNKNOWN, /* Unknown command. */
|
Q_UNKNOWN, /* Unknown command. */
|
||||||
Q_COMMENT, /* Comments, ignored. */
|
Q_COMMENT, /* Comments, ignored. */
|
||||||
@ -360,8 +360,8 @@ const char *command_names[]=
|
|||||||
"change_user",
|
"change_user",
|
||||||
"mkdir",
|
"mkdir",
|
||||||
"rmdir",
|
"rmdir",
|
||||||
"shutdown",
|
"send_shutdown",
|
||||||
"kill_server",
|
"shutdown_server",
|
||||||
|
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
@ -2056,9 +2056,9 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
|
|||||||
static DYNAMIC_STRING ds_col;
|
static DYNAMIC_STRING ds_col;
|
||||||
static DYNAMIC_STRING ds_row;
|
static DYNAMIC_STRING ds_row;
|
||||||
const struct command_arg query_get_value_args[] = {
|
const struct command_arg query_get_value_args[] = {
|
||||||
"query", ARG_STRING, TRUE, &ds_query, "Query to run",
|
{"query", ARG_STRING, TRUE, &ds_query, "Query to run"},
|
||||||
"column name", ARG_STRING, TRUE, &ds_col, "Name of column",
|
{"column name", ARG_STRING, TRUE, &ds_col, "Name of column"},
|
||||||
"row number", ARG_STRING, TRUE, &ds_row, "Number for row"
|
{"row number", ARG_STRING, TRUE, &ds_row, "Number for row"}
|
||||||
};
|
};
|
||||||
|
|
||||||
DBUG_ENTER("var_set_query_get_value");
|
DBUG_ENTER("var_set_query_get_value");
|
||||||
@ -2821,7 +2821,7 @@ void do_mkdir(struct st_command *command)
|
|||||||
int error;
|
int error;
|
||||||
static DYNAMIC_STRING ds_dirname;
|
static DYNAMIC_STRING ds_dirname;
|
||||||
const struct command_arg mkdir_args[] = {
|
const struct command_arg mkdir_args[] = {
|
||||||
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create"
|
{"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create"}
|
||||||
};
|
};
|
||||||
DBUG_ENTER("do_mkdir");
|
DBUG_ENTER("do_mkdir");
|
||||||
|
|
||||||
@ -2851,7 +2851,7 @@ void do_rmdir(struct st_command *command)
|
|||||||
int error;
|
int error;
|
||||||
static DYNAMIC_STRING ds_dirname;
|
static DYNAMIC_STRING ds_dirname;
|
||||||
const struct command_arg rmdir_args[] = {
|
const struct command_arg rmdir_args[] = {
|
||||||
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove"
|
{"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove"}
|
||||||
};
|
};
|
||||||
DBUG_ENTER("do_rmdir");
|
DBUG_ENTER("do_rmdir");
|
||||||
|
|
||||||
@ -3817,7 +3817,7 @@ void do_set_charset(struct st_command *command)
|
|||||||
int query_get_string(MYSQL* mysql, const char* query,
|
int query_get_string(MYSQL* mysql, const char* query,
|
||||||
int column, DYNAMIC_STRING* ds)
|
int column, DYNAMIC_STRING* ds)
|
||||||
{
|
{
|
||||||
MYSQL_RES *res;
|
MYSQL_RES *res= NULL;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
|
||||||
if (mysql_query(mysql,query) || !(res=mysql_store_result(mysql)))
|
if (mysql_query(mysql,query) || !(res=mysql_store_result(mysql)))
|
||||||
@ -3842,27 +3842,27 @@ int query_get_string(MYSQL* mysql, const char* query,
|
|||||||
NOTE! Currently only works with local server
|
NOTE! Currently only works with local server
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
do_kill_server()
|
do_shutdown_server()
|
||||||
command called command
|
command called command
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
kill_server [<timeout>]
|
shutdown [<timeout>]
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void do_kill_server(struct st_command *command)
|
void do_shutdown_server(struct st_command *command)
|
||||||
{
|
{
|
||||||
int timeout=60, pid;
|
int timeout=60, pid;
|
||||||
DYNAMIC_STRING* ds_pidfile_name;
|
DYNAMIC_STRING ds_pidfile_name;
|
||||||
MYSQL* mysql = &cur_con->mysql;
|
MYSQL* mysql = &cur_con->mysql;
|
||||||
static DYNAMIC_STRING ds_timeout;
|
static DYNAMIC_STRING ds_timeout;
|
||||||
const struct command_arg kill_args[] = {
|
const struct command_arg shutdown_args[] = {
|
||||||
"timeout", ARG_STRING, FALSE, &ds_timeout, "Timeout before killing server"
|
{"timeout", ARG_STRING, FALSE, &ds_timeout, "Timeout before killing server"}
|
||||||
};
|
};
|
||||||
DBUG_ENTER("do_kill_server");
|
DBUG_ENTER("do_shutdown_server");
|
||||||
|
|
||||||
check_command_args(command, command->first_argument,
|
check_command_args(command, command->first_argument, shutdown_args,
|
||||||
kill_args, sizeof(kill_args)/sizeof(struct command_arg),
|
sizeof(shutdown_args)/sizeof(struct command_arg),
|
||||||
' ');
|
' ');
|
||||||
|
|
||||||
if (ds_timeout.length)
|
if (ds_timeout.length)
|
||||||
@ -3874,7 +3874,7 @@ void do_kill_server(struct st_command *command)
|
|||||||
|
|
||||||
/* Get the servers pid_file name and use it to read pid */
|
/* Get the servers pid_file name and use it to read pid */
|
||||||
if (query_get_string(mysql, "SHOW VARIABLES LIKE 'pid_file'", 1,
|
if (query_get_string(mysql, "SHOW VARIABLES LIKE 'pid_file'", 1,
|
||||||
ds_pidfile_name))
|
&ds_pidfile_name))
|
||||||
die("Failed to get pid_file from server");
|
die("Failed to get pid_file from server");
|
||||||
|
|
||||||
/* Read the pid from the file */
|
/* Read the pid from the file */
|
||||||
@ -3882,8 +3882,8 @@ void do_kill_server(struct st_command *command)
|
|||||||
int fd;
|
int fd;
|
||||||
char buff[32];
|
char buff[32];
|
||||||
|
|
||||||
if ((fd= my_open(ds_pidfile_name->str, O_RDONLY, MYF(0))) < 0)
|
if ((fd= my_open(ds_pidfile_name.str, O_RDONLY, MYF(0))) < 0)
|
||||||
die("Failed to open file '%s'", ds_pidfile_name->str);
|
die("Failed to open file '%s'", ds_pidfile_name.str);
|
||||||
if (my_read(fd, (uchar*)&buff,
|
if (my_read(fd, (uchar*)&buff,
|
||||||
sizeof(buff), MYF(0)) <= 0){
|
sizeof(buff), MYF(0)) <= 0){
|
||||||
my_close(fd, MYF(0));
|
my_close(fd, MYF(0));
|
||||||
@ -3895,13 +3895,13 @@ void do_kill_server(struct st_command *command)
|
|||||||
my_close(fd, MYF(0));
|
my_close(fd, MYF(0));
|
||||||
die("pid file was empty");
|
die("pid file was empty");
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("Read pid %d from '%s'", pid, ds_pidfile_name->str));
|
DBUG_PRINT("info", ("Read pid %d from '%s'", pid, ds_pidfile_name.str));
|
||||||
my_close(fd, MYF(0));
|
my_close(fd, MYF(0));
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("Got pid %d", pid));
|
DBUG_PRINT("info", ("Got pid %d", pid));
|
||||||
|
|
||||||
/* Tell server to shutdown */
|
/* Tell server to shutdown if timeout > 0*/
|
||||||
if (mysql_shutdown(&cur_con->mysql, SHUTDOWN_DEFAULT))
|
if (timeout && mysql_shutdown(&cur_con->mysql, SHUTDOWN_DEFAULT))
|
||||||
die("mysql_shutdown failed");
|
die("mysql_shutdown failed");
|
||||||
|
|
||||||
/* Check that server dies */
|
/* Check that server dies */
|
||||||
@ -7311,13 +7311,13 @@ int main(int argc, char **argv)
|
|||||||
case Q_PING:
|
case Q_PING:
|
||||||
handle_command_error(command, mysql_ping(&cur_con->mysql));
|
handle_command_error(command, mysql_ping(&cur_con->mysql));
|
||||||
break;
|
break;
|
||||||
case Q_SHUTDOWN:
|
case Q_SEND_SHUTDOWN:
|
||||||
handle_command_error(command,
|
handle_command_error(command,
|
||||||
mysql_shutdown(&cur_con->mysql,
|
mysql_shutdown(&cur_con->mysql,
|
||||||
SHUTDOWN_DEFAULT));
|
SHUTDOWN_DEFAULT));
|
||||||
break;
|
break;
|
||||||
case Q_KILL_SERVER:
|
case Q_SHUTDOWN_SERVER:
|
||||||
do_kill_server(command);
|
do_shutdown_server(command);
|
||||||
break;
|
break;
|
||||||
case Q_EXEC:
|
case Q_EXEC:
|
||||||
do_exec(command);
|
do_exec(command);
|
||||||
|
@ -6,7 +6,7 @@ EOF
|
|||||||
|
|
||||||
# Send shutdown to the connected server and give
|
# Send shutdown to the connected server and give
|
||||||
# it 10 seconds to die before zapping it
|
# it 10 seconds to die before zapping it
|
||||||
kill_server 10;
|
shutdown_server 10;
|
||||||
|
|
||||||
|
|
||||||
# Turn on reconnect
|
# Turn on reconnect
|
||||||
|
@ -1303,6 +1303,18 @@ sub remove_stale_vardir () {
|
|||||||
mtr_error("No, don't remove the vardir when running with --extern")
|
mtr_error("No, don't remove the vardir when running with --extern")
|
||||||
if using_extern();
|
if using_extern();
|
||||||
|
|
||||||
|
my $tmpdir= "$opt_vardir/tmp";
|
||||||
|
if ( -l $tmpdir)
|
||||||
|
{
|
||||||
|
# var/tmp is a symlink
|
||||||
|
mtr_verbose("Removing " . readlink($tmpdir));
|
||||||
|
rmtree(readlink($tmpdir));
|
||||||
|
|
||||||
|
# Remove the "tmp" symlink
|
||||||
|
mtr_verbose("unlink($tmpdir)");
|
||||||
|
unlink($tmpdir);
|
||||||
|
}
|
||||||
|
|
||||||
mtr_verbose("opt_vardir: $opt_vardir");
|
mtr_verbose("opt_vardir: $opt_vardir");
|
||||||
if ( $opt_vardir eq $default_vardir )
|
if ( $opt_vardir eq $default_vardir )
|
||||||
{
|
{
|
||||||
@ -1422,8 +1434,12 @@ sub setup_vardir() {
|
|||||||
|
|
||||||
mkpath("$opt_vardir/log");
|
mkpath("$opt_vardir/log");
|
||||||
mkpath("$opt_vardir/run");
|
mkpath("$opt_vardir/run");
|
||||||
mkpath("$opt_vardir/tmp");
|
|
||||||
mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
|
mkpath($opt_tmpdir);
|
||||||
|
if ($opt_tmpdir ne "$opt_vardir/tmp"){
|
||||||
|
mtr_report(" - symlinking 'var/tmp' to '$opt_tmpdir'");
|
||||||
|
symlink($opt_tmpdir, "$opt_vardir/tmp");
|
||||||
|
}
|
||||||
|
|
||||||
# copy all files from std_data into var/std_data
|
# copy all files from std_data into var/std_data
|
||||||
# and make them writable
|
# and make them writable
|
||||||
@ -2701,7 +2717,7 @@ sub after_test_failure ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove all files in var/tmp
|
# Remove all files in the tmpdir
|
||||||
rmtree($opt_tmpdir);
|
rmtree($opt_tmpdir);
|
||||||
mkpath($opt_tmpdir);
|
mkpath($opt_tmpdir);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user