diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-09 03:55:26 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-09 03:55:26 +0200 |
commit | 9d812016c1287fe06a0c0715f0b2852c919cff82 (patch) | |
tree | af09adc5a3ec6814545553d72fda1d33e443d162 /client/mysqladmin.c | |
parent | cd2f741d5d2cc52928668c6ce1f77052d1ca8a3b (diff) | |
parent | cf2ef3c68f696707671a96c8a2ad6c8449390f4a (diff) | |
download | mariadb-git-9d812016c1287fe06a0c0715f0b2852c919cff82.tar.gz |
merge with 4.0.9
To get bug fixes for TCP/IP connections, FORCE INDEX and OPTIMIZE TABLE with NULL keys
client/mysqladmin.c:
Auto merged
client/mysqltest.c:
Auto merged
extra/Makefile.am:
Auto merged
include/my_base.h:
Auto merged
innobase/log/log0log.c:
Auto merged
myisam/ft_nlq_search.c:
Auto merged
myisam/mi_open.c:
Auto merged
myisam/myisamdef.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/myisam.result:
Auto merged
sql/lex.h:
Auto merged
sql/log_event.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql-bench/crash-me.sh:
Auto merged
sql-bench/test-insert.sh:
Auto merged
sql/sql_show.cc:
Auto merged
sql/table.h:
Auto merged
configure.in:
merge with 4.0.9
innobase/btr/btr0pcur.c:
merge with 4.0.9
myisam/mi_check.c:
merge with 4.0.9
myisam/mi_search.c:
merge with 4.0.9
mysql-test/t/myisam.test:
merge with 4.0.9
sql/log_event.cc:
merge with 4.0.9
sql/mysql_priv.h:
merge with 4.0.9
sql/sql_lex.h:
merge with 4.0.9
sql/sql_parse.cc:
merge with 4.0.9
sql/sql_yacc.yy:
merge with 4.0.9
Diffstat (limited to 'client/mysqladmin.c')
-rw-r--r-- | client/mysqladmin.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/client/mysqladmin.c b/client/mysqladmin.c index 2c8314d83ca..2fc77552d5f 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -25,7 +25,7 @@ #include <sys/stat.h> #include <mysql.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 @@ -76,8 +76,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); /* @@ -513,7 +513,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; } @@ -1150,34 +1151,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); } |