Commit 8c2acc59 authored by unknown's avatar unknown

Fixed bug that caused client to hang because mysqld never did send an

error message if the table open or the index creation failed.
Updated portuguese error messages.
Fix for OS/2 that affected CHECK TABLE.


Docs/manual.texi:
  Changelog.
libmysql/errmsg.c:
  Updated portuguese error messages
mysys/my_copy.c:
  Fix for OS/2
sql/net_pkg.cc:
  cleanup
sql/share/portuguese/errmsg.txt:
  Updated portuguese error messages
sql/slave.cc:
  Cleanup.
  Fixed bug that caused client to hang because mysqld never did
  send an error message if the table open or the index creation failed.
sql/sql_parse.cc:
  Moved handling of 'no_send_ok' to fetch_nx_table.
sql/sql_table.cc:
  Cleanup.
parent 3b1a6ddf
...@@ -9603,7 +9603,7 @@ shell> cd mysql_installation_directory ...@@ -9603,7 +9603,7 @@ shell> cd mysql_installation_directory
shell> ./bin/safe_mysqld --user=mysql & shell> ./bin/safe_mysqld --user=mysql &
@end example @end example
For a binary distribution, do this: For a binary distribution (not RPM or pkg packages), do this:
@example @example
shell> cd mysql_installation_directory shell> cd mysql_installation_directory
...@@ -45459,6 +45459,8 @@ Slovak error messages. ...@@ -45459,6 +45459,8 @@ Slovak error messages.
Romanian error messages. Romanian error messages.
@item Peter Feher @item Peter Feher
Hungarian error messages. Hungarian error messages.
@item Roberto M. Serqueira
Portugise error messages.
@item David Sacerdote @email{davids@@secnet.com} @item David Sacerdote @email{davids@@secnet.com}
Ideas for secure checking of DNS hostnames. Ideas for secure checking of DNS hostnames.
@item Wei-Jou Chen @email{jou@@nematic.ieo.nctu.edu.tw} @item Wei-Jou Chen @email{jou@@nematic.ieo.nctu.edu.tw}
...@@ -45725,6 +45727,8 @@ not yet 100% confident in this code. ...@@ -45725,6 +45727,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.39 @appendixsubsec Changes in release 3.23.39
@itemize @bullet @itemize @bullet
@item @item
Fixed problem that client 'hang' when @code{LOAD TABLE FROM MASTER} failed.
@item
Running @code{myisamchk --fast --force} will not anymore repair tables Running @code{myisamchk --fast --force} will not anymore repair tables
that only had the open count wrong. that only had the open count wrong.
@item @item
...@@ -48,6 +48,34 @@ const char *client_errors[]= ...@@ -48,6 +48,34 @@ const char *client_errors[]=
"Got packet bigger than 'max_allowed_packet'" "Got packet bigger than 'max_allowed_packet'"
}; };
/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */
#elif defined PORTUGUESE
const char *client_errors[]=
{
"Erro desconhecido do MySQL",
"No pode criar 'UNIX socket' (%d)",
"No pode se conectar ao servidor MySQL local atravs do 'socket' '%-.64s' (%d)",
"No pode se conectar ao servidor MySQL em '%-.64s' (%d)",
"No pode criar 'socket TCP/IP' (%d)",
"'Host' servidor MySQL '%-.64s' (%d) desconhecido",
"Servidor MySQL desapareceu",
"Incompatibilidade de protocolos. Verso do Servidor: %d - Verso do Cliente: %d",
"Cliente do MySQL com falta de memria",
"Informao invlida de 'host'",
"Localhost via 'UNIX socket'",
"%-.64s via 'TCP/IP'",
"Erro na negociao de acesso ao servidor",
"Conexo perdida com servidor MySQL durante 'query'",
"Comandos fora de sincronismo. Voc no pode executar este comando agora",
"%-.64s via 'named pipe'",
"No pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)",
"No pode inicializar conjunto de caracteres %-.64s (caminho %-.64s)",
"Obteve pacote maior do que 'max_allowed_packet'"
};
#else /* ENGLISH */ #else /* ENGLISH */
const char *client_errors[]= const char *client_errors[]=
{ {
......
...@@ -54,7 +54,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) ...@@ -54,7 +54,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */
new_file_stat=stat((char*) to, &new_stat_buff); new_file_stat=stat((char*) to, &new_stat_buff);
if ((from_file=my_open(from,O_RDONLY,MyFlags)) >= 0) if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0)
{ {
if (stat(from,&stat_buff)) if (stat(from,&stat_buff))
{ {
...@@ -64,7 +64,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) ...@@ -64,7 +64,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
stat_buff=new_stat_buff; stat_buff=new_stat_buff;
if ((to_file= my_create(to,(int) stat_buff.st_mode, if ((to_file= my_create(to,(int) stat_buff.st_mode,
O_WRONLY | O_TRUNC | O_BINARY, O_WRONLY | O_TRUNC | O_BINARY | O_SHARE,
MyFlags)) < 0) MyFlags)) < 0)
goto err; goto err;
......
...@@ -140,7 +140,7 @@ net_printf(NET *net, uint errcode, ...) ...@@ -140,7 +140,7 @@ net_printf(NET *net, uint errcode, ...)
void void
send_ok(NET *net,ha_rows affected_rows,ulonglong id,const char *message) send_ok(NET *net,ha_rows affected_rows,ulonglong id,const char *message)
{ {
if(net->no_send_ok) if (net->no_send_ok) // hack for re-parsing queries
return; return;
char buff[MYSQL_ERRMSG_SIZE+10],*pos; char buff[MYSQL_ERRMSG_SIZE+10],*pos;
......
This diff is collapsed.
...@@ -314,28 +314,31 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -314,28 +314,31 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
const char* table_name) const char* table_name)
{ {
uint packet_len = my_net_read(net); // read create table statement uint packet_len = my_net_read(net); // read create table statement
Vio* save_vio;
HA_CHECK_OPT check_opt;
TABLE_LIST tables; TABLE_LIST tables;
int error = 0; int error= 1;
handler *file;
if(packet_len == packet_error) if (packet_len == packet_error)
{ {
send_error(&thd->net, ER_MASTER_NET_READ); send_error(&thd->net, ER_MASTER_NET_READ);
return 1; return 1;
} }
if(net->read_pos[0] == 255) // error from master if (net->read_pos[0] == 255) // error from master
{ {
net->read_pos[packet_len] = 0; net->read_pos[packet_len] = 0;
net_printf(&thd->net, ER_MASTER, net->read_pos + 3); net_printf(&thd->net, ER_MASTER, net->read_pos + 3);
return 1; return 1;
} }
thd->command = COM_TABLE_DUMP; thd->command = COM_TABLE_DUMP;
thd->query = sql_alloc(packet_len + 1); thd->query = sql_alloc(packet_len + 1);
if(!thd->query) if (!thd->query)
{ {
sql_print_error("create_table_from_dump: out of memory"); sql_print_error("create_table_from_dump: out of memory");
net_printf(&thd->net, ER_GET_ERRNO, "Out of memory"); net_printf(&thd->net, ER_GET_ERRNO, "Out of memory");
return 1; return 1;
} }
memcpy(thd->query, net->read_pos, packet_len); memcpy(thd->query, net->read_pos, packet_len);
thd->query[packet_len] = 0; thd->query[packet_len] = 0;
thd->current_tablenr = 0; thd->current_tablenr = 0;
...@@ -346,13 +349,10 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -346,13 +349,10 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
char* save_db = thd->db; char* save_db = thd->db;
thd->db = thd->last_nx_db; thd->db = thd->last_nx_db;
mysql_parse(thd, thd->query, packet_len); // run create table mysql_parse(thd, thd->query, packet_len); // run create table
thd->db = save_db; // leave things the way the were before thd->db = save_db; // leave things the way the were before
if(thd->query_error) if (thd->query_error)
{ goto err; // mysql_parse took care of the error send
close_thread_tables(thd); // mysql_parse takes care of the error send
return 1;
}
bzero((char*) &tables,sizeof(tables)); bzero((char*) &tables,sizeof(tables));
tables.db = (char*)db; tables.db = (char*)db;
...@@ -361,41 +361,37 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, ...@@ -361,41 +361,37 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
thd->proc_info = "Opening master dump table"; thd->proc_info = "Opening master dump table";
if (!open_ltable(thd, &tables, TL_WRITE)) if (!open_ltable(thd, &tables, TL_WRITE))
{ {
// open tables will send the error send_error(&thd->net,0,0); // Send error from open_ltable
sql_print_error("create_table_from_dump: could not open created table"); sql_print_error("create_table_from_dump: could not open created table");
close_thread_tables(thd); goto err;
return 1;
} }
handler *file = tables.table->file; file = tables.table->file;
thd->proc_info = "Reading master dump table data"; thd->proc_info = "Reading master dump table data";
if (file->net_read_dump(net)) if (file->net_read_dump(net))
{ {
net_printf(&thd->net, ER_MASTER_NET_READ); net_printf(&thd->net, ER_MASTER_NET_READ);
sql_print_error("create_table_from_dump::failed in\ sql_print_error("create_table_from_dump::failed in\
handler::net_read_dump()"); handler::net_read_dump()");
close_thread_tables(thd); goto err;
return 1;
} }
HA_CHECK_OPT check_opt;
check_opt.init(); check_opt.init();
check_opt.flags|= T_VERY_SILENT; check_opt.flags|= T_VERY_SILENT;
check_opt.quick = 1; check_opt.quick = 1;
thd->proc_info = "Rebuilding the index on master dump table"; thd->proc_info = "Rebuilding the index on master dump table";
Vio* save_vio = thd->net.vio;
// we do not want repair() to spam us with messages // we do not want repair() to spam us with messages
// just send them to the error log, and report the failure in case of // just send them to the error log, and report the failure in case of
// problems // problems
save_vio = thd->net.vio;
thd->net.vio = 0; thd->net.vio = 0;
if (file->repair(thd,&check_opt )) error=file->repair(thd,&check_opt) != 0;
{
net_printf(&thd->net, ER_INDEX_REBUILD,tables.table->real_name );
error = 1;
}
thd->net.vio = save_vio; thd->net.vio = save_vio;
if (error)
net_printf(&thd->net, ER_INDEX_REBUILD,tables.table->real_name);
err:
close_thread_tables(thd); close_thread_tables(thd);
thd->net.no_send_ok = 0; thd->net.no_send_ok = 0;
return error; return error;
} }
...@@ -405,31 +401,31 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi) ...@@ -405,31 +401,31 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
MYSQL* mysql = mc_mysql_init(NULL); MYSQL* mysql = mc_mysql_init(NULL);
int error = 1; int error = 1;
int nx_errno = 0; int nx_errno = 0;
if(!mysql) if (!mysql)
{ {
sql_print_error("fetch_nx_table: Error in mysql_init()"); sql_print_error("fetch_nx_table: Error in mysql_init()");
nx_errno = ER_GET_ERRNO; nx_errno = ER_GET_ERRNO;
goto err; goto err;
} }
safe_connect(thd, mysql, mi); safe_connect(thd, mysql, mi);
if(slave_killed(thd)) if (slave_killed(thd))
goto err; goto err;
if(request_table_dump(mysql, thd->last_nx_db, thd->last_nx_table)) if (request_table_dump(mysql, thd->last_nx_db, thd->last_nx_table))
{ {
nx_errno = ER_GET_ERRNO; nx_errno = ER_GET_ERRNO;
sql_print_error("fetch_nx_table: failed on table dump request "); sql_print_error("fetch_nx_table: failed on table dump request ");
goto err; goto err;
} }
if(create_table_from_dump(thd, &mysql->net, thd->last_nx_db, if (create_table_from_dump(thd, &mysql->net, thd->last_nx_db,
thd->last_nx_table)) thd->last_nx_table))
{ {
// create_table_from_dump will have sent the error alread // create_table_from_dump will have sent the error alread
sql_print_error("fetch_nx_table: failed on create table "); sql_print_error("fetch_nx_table: failed on create table ");
goto err; goto err;
} }
error = 0; error = 0;
...@@ -438,6 +434,7 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi) ...@@ -438,6 +434,7 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
mc_mysql_close(mysql); mc_mysql_close(mysql);
if (nx_errno && thd->net.vio) if (nx_errno && thd->net.vio)
send_error(&thd->net, nx_errno, "Error in fetch_nx_table"); send_error(&thd->net, nx_errno, "Error in fetch_nx_table");
thd->net.no_send_ok = 0; // Clear up garbage after create_table_from_dump
return error; return error;
} }
......
...@@ -1210,23 +1210,13 @@ mysql_execute_command(void) ...@@ -1210,23 +1210,13 @@ mysql_execute_command(void)
if (strlen(tables->name) > NAME_LEN) if (strlen(tables->name) > NAME_LEN)
{ {
net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->name); net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->name);
res=0;
break; break;
} }
thd->last_nx_table = tables->real_name; thd->last_nx_table = tables->real_name;
thd->last_nx_db = tables->db; thd->last_nx_db = tables->db;
if(fetch_nx_table(thd, &glob_mi)) if (fetch_nx_table(thd, &glob_mi))
// fetch_nx_table is responsible for sending break; // fetch_nx_table did send the error to the client
// the error
{
res = 0;
thd->net.no_send_ok = 0; // easier to do it here
// this way we make sure that when we are done, we are clean
break;
}
res = 0;
send_ok(&thd->net); send_ok(&thd->net);
break; break;
......
...@@ -832,13 +832,13 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) ...@@ -832,13 +832,13 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
int lock_retcode; int lock_retcode;
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
if((lock_retcode = lock_table_name(thd, table)) < 0) if ((lock_retcode = lock_table_name(thd, table)) < 0)
{ {
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if(lock_retcode && wait_for_locked_table_names(thd, table)) if (lock_retcode && wait_for_locked_table_names(thd, table))
{ {
unlock_table_name(thd, table); unlock_table_name(thd, table);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
...@@ -846,7 +846,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) ...@@ -846,7 +846,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
} }
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
if(my_copy(src_path, if (my_copy(src_path,
fn_format(dst_path, dst_path,"", fn_format(dst_path, dst_path,"",
reg_ext, 4), reg_ext, 4),
MYF(MY_WME))) MYF(MY_WME)))
...@@ -860,7 +860,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) ...@@ -860,7 +860,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
// generate table will try to send OK which messes up the output // generate table will try to send OK which messes up the output
// for the client // for the client
if(generate_table(thd, table, 0)) if (generate_table(thd, table, 0))
{ {
unlock_table_name(thd, table); unlock_table_name(thd, table);
thd->net.no_send_ok = save_no_send_ok; thd->net.no_send_ok = save_no_send_ok;
...@@ -921,7 +921,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -921,7 +921,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
// now we should be able to open the partially restored table // now we should be able to open the partially restored table
// to finish the restore in the handler later on // to finish the restore in the handler later on
if(!(table->table = reopen_name_locked_table(thd, table))) if (!(table->table = reopen_name_locked_table(thd, table)))
unlock_table_name(thd, table); unlock_table_name(thd, table);
} }
...@@ -1689,7 +1689,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -1689,7 +1689,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
alter table is to delete the new table so there alter table is to delete the new table so there
is no need to log the changes to it. */ is no need to log the changes to it. */
error = ha_recovery_logging(thd,false); error = ha_recovery_logging(thd,false);
if(error) if (error)
{ {
error = 1; error = 1;
goto err; goto err;
......
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