diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-07 16:53:10 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-07 16:53:10 +0200 |
commit | b3b66f640841e459e18a3d4300766b56f0cf3bc8 (patch) | |
tree | 568a37c17ae407938ff1ec3cae7005605d52e7c6 /client | |
parent | e3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4 (diff) | |
download | mariadb-git-b3b66f640841e459e18a3d4300766b56f0cf3bc8.tar.gz |
Portability fixes
Fixed test suite for HPUX 10.20 and MacOSX
Build-tools/Do-compile:
Added timeout to mysqladmin shutdown commands
Kill old running mysqld started by earlier runs
Removed run time warning from LD_LIBRARY_PATH
client/mysqladmin.c:
Return 1 if pid file isn't deleted on shutdown.
Fix error message if pid file is not deleted
client/mysqltest.c:
Always allow --debug flag
(Makes it easier to run mysql-test-run)
mysql-test/mysql-test-run.sh:
A lot of safety fixes.
This fixes some problems with test suite for HPUX 10.20 and MacOSX
sql-bench/bench-init.pl.sh:
Allow tests to change time limit.
sql-bench/crash-me.sh:
Indentation cleanups
Added DROP for a created table
sql-bench/test-alter-table.sh:
Added default time limit
Changed test to be estimated to get down run time.
Fixed that add_multi_col is detected
sql-bench/test-insert.sh:
Comment cleanup
sql/mysql_priv.h:
Removed not needed prototype.
sql/mysqld.cc:
Removed DBUG warnings
Removed default argument for clean_up() and made it static.
More comments.
Ignore SIGHUP during shutdown
sql/net_pkg.cc:
More comments
sql/slave.cc:
Added DBUG_PRINT messages
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqladmin.c | 62 | ||||
-rw-r--r-- | client/mysqltest.c | 8 |
2 files changed, 44 insertions, 26 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 00af8c592ec..5446718dea6 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -24,7 +24,7 @@ #endif #include <sys/stat.h> -#define ADMIN_VERSION "8.38" +#define ADMIN_VERSION "8.39" #define MAX_MYSQL_VAR 128 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -70,8 +70,8 @@ static void print_relative_header(); static void print_relative_line(); static void truncate_names(); static my_bool get_pidfile(MYSQL *mysql, char *pidfile); -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status); +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status); static void store_values(MYSQL_RES *result); /* @@ -481,7 +481,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) printf("Shutdown signal sent to server; Waiting for pid file to disappear\n"); /* Wait until pid file is gone */ - wait_pidfile(pidfile, last_modified, &pidfile_status); + if (wait_pidfile(pidfile, last_modified, &pidfile_status)) + return -1; } break; } @@ -1110,34 +1111,51 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile) return 1; /* Error */ } +/* + Return 1 if pid file didn't disappear or change +*/ -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status) +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status) { char buff[FN_REFLEN]; - int fd = -1; - uint count=0; + int error= 1; + uint count= 0; + DBUG_ENTER("wait_pidfile"); system_filename(buff, pidfile); - while (count++ <= opt_shutdown_timeout && !interrupted && - (!last_modified || (last_modified == pidfile_status->st_mtime)) && - (fd= my_open(buff, O_RDONLY, MYF(0))) >= 0) + do { - if (!my_close(fd,MYF(0))) - fd= -1; + int fd; + if ((fd= my_open(buff, O_RDONLY, MYF(0))) < 0) + { + error= 0; + break; + } + (void) my_close(fd,MYF(0)); + if (last_modified && !stat(pidfile, pidfile_status)) + { + if (last_modified != pidfile_status->st_mtime) + { + /* File changed; Let's assume that mysqld did restart */ + if (opt_verbose) + printf("pid file '%s' changed while waiting for it to disappear!\nmysqld did probably restart\n", + buff); + error= 0; + break; + } + } + if (count++ == opt_shutdown_timeout) + break; sleep(1); - if (last_modified && stat(pidfile, pidfile_status)) - last_modified= 0; - } - if (opt_verbose && last_modified && - last_modified != pidfile_status->st_mtime) - printf("Warning; pid file '%s' changed while waiting for it to disappear!\n", - buff); - if (fd >= 0) + } while (!interrupted); + + if (error) { - my_close(fd,MYF(0)); + DBUG_PRINT("warning",("Pid file didn't disappear")); fprintf(stderr, "Warning; Aborted waiting on pid file: '%s' after %d seconds\n", buff, count-1); } + DBUG_RETURN(error); } diff --git a/client/mysqltest.c b/client/mysqltest.c index 20d277ca969..fe99dda1ac3 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.25" +#define MTEST_VERSION "1.26" #include <my_global.h> #include <mysql_embed.h> @@ -1797,10 +1797,8 @@ int read_query(struct st_query** q_ptr) static struct my_option my_long_options[] = { -#ifndef DBUG_OFF {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir, @@ -1893,7 +1891,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { switch(optid) { case '#': +#ifndef DBUG_OFF DBUG_PUSH(argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace"); +#endif break; case 'r': record = 1; @@ -1971,7 +1971,7 @@ int parse_args(int argc, char **argv) default_argv= argv; if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - exit(ho_error); + exit(1); if (argc > 1) { |