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
shell> ./bin/safe_mysqld --user=mysql &
@end example
For a binary distribution, do this:
For a binary distribution (not RPM or pkg packages), do this:
@example
shell> cd mysql_installation_directory
......@@ -45459,6 +45459,8 @@ Slovak error messages.
Romanian error messages.
@item Peter Feher
Hungarian error messages.
@item Roberto M. Serqueira
Portugise error messages.
@item David Sacerdote @email{davids@@secnet.com}
Ideas for secure checking of DNS hostnames.
@item Wei-Jou Chen @email{jou@@nematic.ieo.nctu.edu.tw}
......@@ -45725,6 +45727,8 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.39
@itemize @bullet
@item
Fixed problem that client 'hang' when @code{LOAD TABLE FROM MASTER} failed.
@item
Running @code{myisamchk --fast --force} will not anymore repair tables
that only had the open count wrong.
@item
......@@ -48,6 +48,34 @@ const char *client_errors[]=
"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 */
const char *client_errors[]=
{
......
......@@ -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 */
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))
{
......@@ -64,7 +64,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
stat_buff=new_stat_buff;
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)
goto err;
......
......@@ -140,7 +140,7 @@ net_printf(NET *net, uint errcode, ...)
void
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;
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,
const char* table_name)
{
uint packet_len = my_net_read(net); // read create table statement
Vio* save_vio;
HA_CHECK_OPT check_opt;
TABLE_LIST tables;
int error = 0;
int error= 1;
handler *file;
if(packet_len == packet_error)
{
send_error(&thd->net, ER_MASTER_NET_READ);
return 1;
}
if(net->read_pos[0] == 255) // error from master
{
net->read_pos[packet_len] = 0;
net_printf(&thd->net, ER_MASTER, net->read_pos + 3);
return 1;
}
if (packet_len == packet_error)
{
send_error(&thd->net, ER_MASTER_NET_READ);
return 1;
}
if (net->read_pos[0] == 255) // error from master
{
net->read_pos[packet_len] = 0;
net_printf(&thd->net, ER_MASTER, net->read_pos + 3);
return 1;
}
thd->command = COM_TABLE_DUMP;
thd->query = sql_alloc(packet_len + 1);
if(!thd->query)
{
sql_print_error("create_table_from_dump: out of memory");
net_printf(&thd->net, ER_GET_ERRNO, "Out of memory");
return 1;
}
if (!thd->query)
{
sql_print_error("create_table_from_dump: out of memory");
net_printf(&thd->net, ER_GET_ERRNO, "Out of memory");
return 1;
}
memcpy(thd->query, net->read_pos, packet_len);
thd->query[packet_len] = 0;
thd->current_tablenr = 0;
......@@ -346,13 +349,10 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
char* save_db = thd->db;
thd->db = thd->last_nx_db;
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)
{
close_thread_tables(thd); // mysql_parse takes care of the error send
return 1;
}
if (thd->query_error)
goto err; // mysql_parse took care of the error send
bzero((char*) &tables,sizeof(tables));
tables.db = (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";
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");
close_thread_tables(thd);
return 1;
goto err;
}
handler *file = tables.table->file;
file = tables.table->file;
thd->proc_info = "Reading master dump table data";
if (file->net_read_dump(net))
{
net_printf(&thd->net, ER_MASTER_NET_READ);
sql_print_error("create_table_from_dump::failed in\
handler::net_read_dump()");
close_thread_tables(thd);
return 1;
goto err;
}
HA_CHECK_OPT check_opt;
check_opt.init();
check_opt.flags|= T_VERY_SILENT;
check_opt.quick = 1;
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
// just send them to the error log, and report the failure in case of
// problems
save_vio = thd->net.vio;
thd->net.vio = 0;
if (file->repair(thd,&check_opt ))
{
net_printf(&thd->net, ER_INDEX_REBUILD,tables.table->real_name );
error = 1;
}
error=file->repair(thd,&check_opt) != 0;
thd->net.vio = save_vio;
if (error)
net_printf(&thd->net, ER_INDEX_REBUILD,tables.table->real_name);
err:
close_thread_tables(thd);
thd->net.no_send_ok = 0;
return error;
}
......@@ -405,31 +401,31 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
MYSQL* mysql = mc_mysql_init(NULL);
int error = 1;
int nx_errno = 0;
if(!mysql)
{
sql_print_error("fetch_nx_table: Error in mysql_init()");
nx_errno = ER_GET_ERRNO;
goto err;
}
if (!mysql)
{
sql_print_error("fetch_nx_table: Error in mysql_init()");
nx_errno = ER_GET_ERRNO;
goto err;
}
safe_connect(thd, mysql, mi);
if(slave_killed(thd))
if (slave_killed(thd))
goto err;
if(request_table_dump(mysql, thd->last_nx_db, thd->last_nx_table))
{
nx_errno = ER_GET_ERRNO;
sql_print_error("fetch_nx_table: failed on table dump request ");
goto err;
}
if (request_table_dump(mysql, thd->last_nx_db, thd->last_nx_table))
{
nx_errno = ER_GET_ERRNO;
sql_print_error("fetch_nx_table: failed on table dump request ");
goto err;
}
if(create_table_from_dump(thd, &mysql->net, thd->last_nx_db,
thd->last_nx_table))
{
// create_table_from_dump will have sent the error alread
sql_print_error("fetch_nx_table: failed on create table ");
goto err;
}
if (create_table_from_dump(thd, &mysql->net, thd->last_nx_db,
thd->last_nx_table))
{
// create_table_from_dump will have sent the error alread
sql_print_error("fetch_nx_table: failed on create table ");
goto err;
}
error = 0;
......@@ -438,6 +434,7 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
mc_mysql_close(mysql);
if (nx_errno && thd->net.vio)
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;
}
......
......@@ -1210,23 +1210,13 @@ mysql_execute_command(void)
if (strlen(tables->name) > NAME_LEN)
{
net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->name);
res=0;
break;
}
thd->last_nx_table = tables->real_name;
thd->last_nx_db = tables->db;
if(fetch_nx_table(thd, &glob_mi))
// fetch_nx_table is responsible for sending
// 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;
if (fetch_nx_table(thd, &glob_mi))
break; // fetch_nx_table did send the error to the client
send_ok(&thd->net);
break;
......
......@@ -832,13 +832,13 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
int lock_retcode;
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);
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);
pthread_mutex_unlock(&LOCK_open);
......@@ -846,7 +846,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
}
pthread_mutex_unlock(&LOCK_open);
if(my_copy(src_path,
if (my_copy(src_path,
fn_format(dst_path, dst_path,"",
reg_ext, 4),
MYF(MY_WME)))
......@@ -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
// for the client
if(generate_table(thd, table, 0))
if (generate_table(thd, table, 0))
{
unlock_table_name(thd, table);
thd->net.no_send_ok = save_no_send_ok;
......@@ -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
// 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);
}
......@@ -1689,7 +1689,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
alter table is to delete the new table so there
is no need to log the changes to it. */
error = ha_recovery_logging(thd,false);
if(error)
if (error)
{
error = 1;
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