From 8a975f4a306dd5cfb80958fc01661b504605505c Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Tue, 20 Jun 2006 17:06:35 +0500 Subject: [PATCH 1/4] bug #19672 (paths in embedded server are trucated in error messages) It fact, filenames are truncated in normal server as well, just we get bigger filenames in embedded server tests, but that can potentially get some problems in both cases. I modified file-related error messages to allow longer filenames --- sql/share/errmsg.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 4e7b9200d88..598417f9a3a 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -54,7 +54,7 @@ ER_CANT_CREATE_FILE cze "Nemohu vytvo-Bit soubor '%-.64s' (chybov kd: %d)" dan "Kan ikke oprette filen '%-.64s' (Fejlkode: %d)" nla "Kan file '%-.64s' niet aanmaken (Errcode: %d)" - eng "Can't create file '%-.64s' (errno: %d)" + eng "Can't create file '%-.200s' (errno: %d)" est "Ei suuda luua faili '%-.64s' (veakood: %d)" fre "Ne peut crer le fichier '%-.64s' (Errcode: %d)" ger "Kann Datei '%-.64s' nicht erzeugen (Fehler: %d)" @@ -278,7 +278,7 @@ ER_CANT_GET_STAT cze "Nemohu z-Bskat stav '%-.64s' (chybov kd: %d)" dan "Kan ikke lse status af '%-.64s' (Fejlkode: %d)" nla "Kan de status niet krijgen van '%-.64s' (Errcode: %d)" - eng "Can't get status of '%-.64s' (errno: %d)" + eng "Can't get status of '%-.200s' (errno: %d)" jps "'%-.64s' ̃XeC^X܂. (errno: %d)", est "Ei suuda lugeda '%-.64s' olekut (veakood: %d)" fre "Ne peut obtenir le status de '%-.64s' (Errcode: %d)" @@ -353,7 +353,7 @@ ER_CANT_OPEN_FILE cze "Nemohu otev-Bt soubor '%-.64s' (chybov kd: %d)" dan "Kan ikke bne fil: '%-.64s' (Fejlkode: %d)" nla "Kan de file '%-.64s' niet openen (Errcode: %d)" - eng "Can't open file: '%-.64s' (errno: %d)" + eng "Can't open file: '%-.200s' (errno: %d)" jps "'%-.64s' t@CJł܂ (errno: %d)", est "Ei suuda avada faili '%-.64s' (veakood: %d)" fre "Ne peut ouvrir le fichier: '%-.64s' (Errcode: %d)" @@ -378,7 +378,7 @@ ER_FILE_NOT_FOUND cze "Nemohu naj-Bt soubor '%-.64s' (chybov kd: %d)" dan "Kan ikke finde fila: '%-.64s' (Fejlkode: %d)" nla "Kan de file: '%-.64s' niet vinden (Errcode: %d)" - eng "Can't find file: '%-.64s' (errno: %d)" + eng "Can't find file: '%-.200s' (errno: %d)" jps "'%-.64s' t@Ct鎖ł܂.(errno: %d)", est "Ei suuda leida faili '%-.64s' (veakood: %d)" fre "Ne peut trouver le fichier: '%-.64s' (Errcode: %d)" @@ -549,7 +549,7 @@ ER_ERROR_ON_READ cze "Chyba p-Bi ten souboru '%-.64s' (chybov kd: %d)" dan "Fejl ved lsning af '%-.64s' (Fejlkode: %d)" nla "Fout bij het lezen van file '%-.64s' (Errcode: %d)" - eng "Error reading file '%-.64s' (errno: %d)" + eng "Error reading file '%-.200s' (errno: %d)" jps "'%-.64s' t@C̓ǂݍ݃G[ (errno: %d)", est "Viga faili '%-.64s' lugemisel (veakood: %d)" fre "Erreur en lecture du fichier '%-.64s' (Errcode: %d)" @@ -599,7 +599,7 @@ ER_ERROR_ON_WRITE cze "Chyba p-Bi zpisu do souboru '%-.64s' (chybov kd: %d)" dan "Fejl ved skriving av filen '%-.64s' (Fejlkode: %d)" nla "Fout bij het wegschrijven van file '%-.64s' (Errcode: %d)" - eng "Error writing file '%-.64s' (errno: %d)" + eng "Error writing file '%-.200s' (errno: %d)" jps "'%-.64s' t@Cł܂ (errno: %d)", est "Viga faili '%-.64s' kirjutamisel (veakood: %d)" fre "Erreur d'criture du fichier '%-.64s' (Errcode: %d)" @@ -772,7 +772,7 @@ ER_NOT_FORM_FILE cze "Nespr-Bvn informace v souboru '%-.64s'" dan "Forkert indhold i: '%-.64s'" nla "Verkeerde info in file: '%-.64s'" - eng "Incorrect information in file: '%-.64s'" + eng "Incorrect information in file: '%-.200s'" jps "t@C '%-.64s' info ԈĂ悤ł", est "Vigane informatsioon failis '%-.64s'" fre "Information erronne dans le fichier: '%-.64s'" @@ -797,7 +797,7 @@ ER_NOT_KEYFILE cze "Nespr-Bvn kl pro tabulku '%-.64s'; pokuste se ho opravit" dan "Fejl i indeksfilen til tabellen '%-.64s'; prv at reparere den" nla "Verkeerde zoeksleutel file voor tabel: '%-.64s'; probeer het te repareren" - eng "Incorrect key file for table '%-.64s'; try to repair it" + eng "Incorrect key file for table '%-.200s'; try to repair it" jps "'%-.64s' e[u key file ԈĂ悤ł. CĂ", est "Tabeli '%-.64s' vtmefail on vigane; proovi seda parandada" fre "Index corrompu dans la table: '%-.64s'; essayez de le rparer" @@ -2044,7 +2044,7 @@ ER_TEXTFILE_NOT_READABLE cze "Soubor '%-.64s' mus-B bt v adresi databze nebo iteln pro vechny" dan "Filen '%-.64s' skal vre i database-folderen og kunne lses af alle" nla "Het bestand '%-.64s' dient in de database directory voor the komen of leesbaar voor iedereen te zijn." - eng "The file '%-.64s' must be in the database directory or be readable by all" + eng "The file '%-.128s' must be in the database directory or be readable by all" jps "t@C '%-.64s' databse directory ɂ邩SẴ[U[ǂ߂悤ɋ‚ĂȂ΂Ȃ܂.", est "Fail '%-.64s' peab asuma andmebaasi kataloogis vi olema kigile loetav" fre "Le fichier '%-.64s' doit tre dans le rpertoire de la base et lisible par tous" @@ -2069,7 +2069,7 @@ ER_FILE_EXISTS_ERROR cze "Soubor '%-.64s' ji-B existuje" dan "Filen '%-.64s' eksisterer allerede" nla "Het bestand '%-.64s' bestaat reeds" - eng "File '%-.80s' already exists" + eng "File '%-.200s' already exists" jps "File '%-.64s' ͊ɑ݂܂", est "Fail '%-.80s' juba eksisteerib" fre "Le fichier '%-.64s' existe dj" @@ -2345,7 +2345,7 @@ ER_NO_UNIQUE_LOGFILE cze "Nemohu vytvo-Bit jednoznan jmno logovacho souboru %s.(1-999)\n" dan "Kan ikke lave unikt log-filnavn %s.(1-999)\n" nla "Het is niet mogelijk een unieke naam te maken voor de logfile %s.(1-999)\n" - eng "Can't generate a unique log-filename %-.64s.(1-999)\n" + eng "Can't generate a unique log-filename %-.200s.(1-999)\n" est "Ei suuda luua unikaalset logifaili nime %-.64s.(1-999)\n" fre "Ne peut gnrer un unique nom de journal %s.(1-999)\n" ger "Kann keinen eindeutigen Dateinamen fr die Logdatei %-.64s(1-999) erzeugen\n" @@ -5218,7 +5218,7 @@ ER_FPARSER_BAD_HEADER rus " '%-.64s'" ukr "צ ̦ '%-.64s'" ER_FPARSER_EOF_IN_COMMENT - eng "Unexpected end of file while parsing comment '%-.64s'" + eng "Unexpected end of file while parsing comment '%-.200s'" ger "Unerwartetes Dateiende beim Parsen des Kommentars '%-.64s'" rus " '%-.64s'" ukr "Ħ ˦ Ҧ '%-.64s'" @@ -5387,7 +5387,7 @@ ER_LOGGING_PROHIBIT_CHANGING_OF eng "Binary logging and replication forbid changing the global server %s" ger "Binrlogs und Replikation verhindern Wechsel des globalen Servers %s" ER_NO_FILE_MAPPING - eng "Can't map file: %-.64s, errno: %d" + eng "Can't map file: %-.200s, errno: %d" ger "Kann Datei nicht abbilden: %-.64s, Fehler: %d" ER_WRONG_MAGIC eng "Wrong magic in %-.64s" From 9a2a3c6edf3bb462a1456adf1fd7f929b4daf5d7 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Tue, 11 Jul 2006 12:42:03 -0700 Subject: [PATCH 2/4] Bug #17485: mysql client crashes when connecting to the Instance Manager Using \U or \u in a prompt with the mysql command-line client could crash when connecting to the instance manager, since it does not return information about the user when asked by the client. This is fixed by having the client use what it knowns about the user (or giving up and saying "(unknown)"). --- client/mysql.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 6fcda6d766f..f4abffaf445 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3623,12 +3623,14 @@ static const char* construct_prompt() case 'U': if (!full_username) init_username(); - processed_prompt.append(full_username); + processed_prompt.append(full_username ? full_username : + (current_user ? current_user : "(unknown)")); break; case 'u': if (!full_username) init_username(); - processed_prompt.append(part_username); + processed_prompt.append(part_username ? part_username : + (current_user ? current_user : "(unknown)")); break; case PROMPT_CHAR: processed_prompt.append(PROMPT_CHAR); From a34f37acdda440322d0b296fa24e17a8b7e29391 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Wed, 12 Jul 2006 12:30:22 -0700 Subject: [PATCH 3/4] Bug #12673: Instance Manager: allows to stop the instance many times The instance manager was not actually checking whether an instance was actually running before trying to stop it. Now it checks first. --- mysql-test/r/im_life_cycle.result | 3 ++ mysql-test/t/im_life_cycle.imtest | 8 ++++ server-tools/instance-manager/instance.cc | 53 ++++++++++++----------- server-tools/instance-manager/messages.cc | 6 +-- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index a9f78aea7d3..211a82eb9cf 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -74,3 +74,6 @@ START INSTANCE mysqld1,mysqld2,mysqld3; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use STOP INSTANCE mysqld1,mysqld2,mysqld3; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use +STOP INSTANCE mysqld2; +ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile. +End of 5.0 tests diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest index 2cbe53a7b28..c3a5fb0a648 100644 --- a/mysql-test/t/im_life_cycle.imtest +++ b/mysql-test/t/im_life_cycle.imtest @@ -218,3 +218,11 @@ START INSTANCE mysqld1,mysqld2,mysqld3; --error ER_SYNTAX_ERROR STOP INSTANCE mysqld1,mysqld2,mysqld3; + +# +# Bug #12673: Instance Manager: allows to stop the instance many times +# +--error 3001 +STOP INSTANCE mysqld2; + +--echo End of 5.0 tests diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 39381b457ab..2ed369ba245 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -469,37 +469,38 @@ int Instance::stop() struct timespec timeout; uint waitchild= (uint) DEFAULT_SHUTDOWN_DELAY; - if (options.shutdown_delay_val) - waitchild= options.shutdown_delay_val; - - kill_instance(SIGTERM); - /* sleep on condition to wait for SIGCHLD */ - - timeout.tv_sec= time(NULL) + waitchild; - timeout.tv_nsec= 0; - if (pthread_mutex_lock(&LOCK_instance)) - goto err; - - while (options.get_pid() != 0) /* while server isn't stopped */ + if (is_running()) { - int status; + if (options.shutdown_delay_val) + waitchild= options.shutdown_delay_val; - status= pthread_cond_timedwait(&COND_instance_stopped, - &LOCK_instance, - &timeout); - if (status == ETIMEDOUT || status == ETIME) - break; + kill_instance(SIGTERM); + /* sleep on condition to wait for SIGCHLD */ + + timeout.tv_sec= time(NULL) + waitchild; + timeout.tv_nsec= 0; + if (pthread_mutex_lock(&LOCK_instance)) + return ER_STOP_INSTANCE; + + while (options.get_pid() != 0) /* while server isn't stopped */ + { + int status; + + status= pthread_cond_timedwait(&COND_instance_stopped, + &LOCK_instance, + &timeout); + if (status == ETIMEDOUT || status == ETIME) + break; + } + + pthread_mutex_unlock(&LOCK_instance); + + kill_instance(SIGKILL); + + return 0; } - pthread_mutex_unlock(&LOCK_instance); - - kill_instance(SIGKILL); - - return 0; - return ER_INSTANCE_IS_NOT_STARTED; -err: - return ER_STOP_INSTANCE; } #ifdef __WIN__ diff --git a/server-tools/instance-manager/messages.cc b/server-tools/instance-manager/messages.cc index a9b00b9e01f..d2595638de0 100644 --- a/server-tools/instance-manager/messages.cc +++ b/server-tools/instance-manager/messages.cc @@ -48,8 +48,8 @@ static const char *mysqld_error_message(unsigned sql_errno) case ER_BAD_INSTANCE_NAME: return "Bad instance name. Check that the instance with such a name exists"; case ER_INSTANCE_IS_NOT_STARTED: - return "Cannot stop instance. Perhaps the instance is not started, or was started" - "manually, so IM cannot find the pidfile."; + return "Cannot stop instance. Perhaps the instance is not started, or was" + " started manually, so IM cannot find the pidfile."; case ER_INSTANCE_ALREADY_STARTED: return "The instance is already started"; case ER_CANNOT_START_INSTANCE: @@ -67,7 +67,7 @@ static const char *mysqld_error_message(unsigned sql_errno) return "Cannot open log file"; case ER_GUESS_LOGFILE: return "Cannot guess the log filename. Try specifying full log name" - "in the instance options"; + " in the instance options"; case ER_ACCESS_OPTION_FILE: return "Cannot open the option file to edit. Check permissions"; default: From 1f064174a47a2f1aa55494e38c86c40a36484984 Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Fri, 21 Jul 2006 17:02:04 +0500 Subject: [PATCH 4/4] bug #20950 (mysql_upgrade looks for 'mysqlcheck' not for 'mysqlcheck.exe' on Windows. Code added to look for different names on Windows --- client/mysql_upgrade.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 3288b627554..ce7eb8dd61b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -17,6 +17,14 @@ #include "client_priv.h" #include +#ifdef __WIN__ +const char *mysqlcheck_name= "mysqlcheck.exe"; +const char *mysql_name= "mysql.exe"; +#else +const char *mysqlcheck_name= "mysqlcheck"; +const char *mysql_name= "mysql"; +#endif /*__WIN__*/ + static my_bool opt_force= 0, opt_verbose= 0, tty_password= 0; static char *user= (char*) "root", *basedir= 0, *datadir= 0, *opt_password= 0; static my_bool upgrade_defaults_created= 0; @@ -272,7 +280,7 @@ int main(int argc, char **argv) strmake(bindir_end, "/bin", sizeof(bindir) - (int) (bindir_end - bindir)-1); if (!test_file_exists_res - (bindir, "mysqlcheck", mysqlcheck_line, &mysqlcheck_end)) + (bindir, mysqlcheck_name, mysqlcheck_line, &mysqlcheck_end)) { printf("Can't find program '%s'\n", mysqlcheck_line); puts("Please restart with --basedir=mysql-install-directory"); @@ -342,7 +350,8 @@ int main(int argc, char **argv) goto err_exit; fix_priv_tables: - if (!test_file_exists_res(bindir, "mysql", fix_priv_tables_cmd, &fix_cmd_end)) + if (!test_file_exists_res(bindir, mysql_name, + fix_priv_tables_cmd, &fix_cmd_end)) { puts("Could not find MySQL command-line client (mysql)."); puts