5 messages in com.mysql.lists.bugsRe[4]: Fwd: LOAD table from master fa...
FromSent OnAttachments
Vinche31 May 2001 02:40 
Sasha Pachev31 May 2001 11:51 
Sasha Pachev31 May 2001 14:28 
Michael Widenius01 Jun 2001 03:27 
Michael Widenius01 Jun 2001 13:36 
Subject:Re[4]: Fwd: LOAD table from master failure
From:Michael Widenius (mon@mysql.com)
Date:06/01/2001 01:36:18 PM
List:com.mysql.lists.bugs

Hi!

"Vinche" == Vinche <Vin@lavtech.ru> writes:

<cut

I just tried to build replica on the fly and encountered strange problem. When I do "LOAD table stopword from master" it hangs forever and in logs I'm getting this

MW> <cut>

MW> Vinche, can you define 'hang' here. Even if you get an error you MW> should not get mysqld to stop. The replication will stop, but this is MW> not the same things as a hang.

Vinche> By saying hang I meant SQL statement never completes. Mysqld really Vinche> not hanging at all, but client doesn't get any error.

This is a bug. I took a look at the code and after a while I found 2 bugs that involved error reporting in create_table_from_dump.

Here is a patch for this:

===== sql/slave.cc 1.102 vs edited ===== *** /tmp/slave.cc-1.102-456 Fri Jun 1 04:10:53 2001 --- edited/sql/slave.cc Fri Jun 1 23:26:38 2001 *************** *** 314,321 **** const char* table_name) { uint packet_len = my_net_read(net); // read create table statement TABLE_LIST tables; ! int error = 0;

if(packet_len == packet_error) { --- 314,324 ---- 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= 1; ! handler *file;

if (packet_len == packet_error) { *************** *** 349,358 **** 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; ! }

bzero((char*) &tables,sizeof(tables)); tables.db = (char*)db; --- 352,358 ---- thd->db = save_db; // leave things the way the were before

if (thd->query_error) ! goto err; // mysql_parse took care of the error send

bzero((char*) &tables,sizeof(tables)); tables.db = (char*)db; *************** *** 361,401 **** thd->proc_info = "Opening master dump table"; if (!open_ltable(thd, &tables, TL_WRITE)) { ! // open tables will send the error sql_print_error("create_table_from_dump: could not open created table"); ! close_thread_tables(thd); ! return 1; }

! handler *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; }

- 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 thd->net.vio = 0; ! if (file->repair(thd,&check_opt )) ! { ! net_printf(&thd->net, ER_INDEX_REBUILD,tables.table->real_name ); ! error = 1; ! } thd->net.vio = save_vio; ! close_thread_tables(thd);

thd->net.no_send_ok = 0; return error; } --- 361,397 ---- thd->proc_info = "Opening master dump table"; if (!open_ltable(thd, &tables, TL_WRITE)) { ! send_error(&thd->net,0,0); // Send error from open_ltable sql_print_error("create_table_from_dump: could not open created table"); ! goto err; }

! 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()"); ! goto err; }

check_opt.init(); check_opt.flags|= T_VERY_SILENT; check_opt.quick = 1; thd->proc_info = "Rebuilding the index on master dump table"; // 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; ! 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; } *************** *** 438,443 **** --- 434,440 ---- 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; }

Regards, Monty

PS: Sasha, the bugs are the net_printf() after file->repair() and not sending the error from open_ltable().