Commit a4e64e25 authored by unknown's avatar unknown

Fixed error handling bug


sql/sql_class.h:
  new function for clean out error message
parent 4358ac0c
...@@ -841,9 +841,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -841,9 +841,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
VOID(pthread_mutex_lock(&LOCK_thread_count)); VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = query_id++; thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count)); VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->query_error = 0; // clear error thd->query_error= 0; // clear error
thd->net.last_errno = 0; thd->clear_error();
thd->net.last_error[0] = 0;
thd->slave_proxy_id = thread_id; // for temp tables thd->slave_proxy_id = thread_id; // for temp tables
/* /*
......
...@@ -451,6 +451,7 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command, ...@@ -451,6 +451,7 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command,
mysql->net.last_error[0]=0; mysql->net.last_error[0]=0;
mysql->net.last_errno=0; mysql->net.last_errno=0;
mysql->net.report_error=0;
mysql->info=0; mysql->info=0;
mysql->affected_rows= ~(my_ulonglong) 0; mysql->affected_rows= ~(my_ulonglong) 0;
net_clear(net); /* Clear receive buffer */ net_clear(net); /* Clear receive buffer */
......
...@@ -1464,9 +1464,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, ...@@ -1464,9 +1464,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
} }
} }
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
thd->net.last_error[0]=0; // Clear error message thd->clear_error(); // Clear error message
thd->net.last_errno=0; error= 0;
error=0;
if (openfrm(path,alias, if (openfrm(path,alias,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX |
HA_TRY_READ_ONLY), HA_TRY_READ_ONLY),
...@@ -1476,8 +1475,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, ...@@ -1476,8 +1475,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
(entry->file->is_crashed() && entry->file->check_and_repair(thd))) (entry->file->is_crashed() && entry->file->check_and_repair(thd)))
{ {
/* Give right error message */ /* Give right error message */
thd->net.last_error[0]=0; thd->clear_error();
thd->net.last_errno=0;
my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno); my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
sql_print_error("Error: Couldn't repair table: %s.%s",db,name); sql_print_error("Error: Couldn't repair table: %s.%s",db,name);
if (entry->file) if (entry->file)
...@@ -1486,8 +1484,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, ...@@ -1486,8 +1484,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
} }
else else
{ {
thd->net.last_error[0]=0; // Clear error message thd->clear_error(); // Clear error message
thd->net.last_errno=0;
} }
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
unlock_table_name(thd,&table_list); unlock_table_name(thd,&table_list);
......
...@@ -625,6 +625,12 @@ public: ...@@ -625,6 +625,12 @@ public:
void add_changed_table(const char *key, long key_length); void add_changed_table(const char *key, long key_length);
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length); CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
int send_explain_fields(select_result *result); int send_explain_fields(select_result *result);
inline void clear_error()
{
net.last_error[0]= 0;
net.last_errno= 0;
net.report_error= 0;
}
}; };
/* /*
......
...@@ -1180,7 +1180,7 @@ bool delayed_insert::handle_inserts(void) ...@@ -1180,7 +1180,7 @@ bool delayed_insert::handle_inserts(void)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
using_ignore=1; using_ignore=1;
} }
thd.net.last_errno = 0; // reset error for binlog thd.clear_error(); // reset error for binlog
if (write_record(table,&info)) if (write_record(table,&info))
{ {
info.error_count++; // Ignore errors info.error_count++; // Ignore errors
......
...@@ -857,8 +857,7 @@ bool do_command(THD *thd) ...@@ -857,8 +857,7 @@ bool do_command(THD *thd)
old_timeout=net->read_timeout; old_timeout=net->read_timeout;
// Wait max for 8 hours // Wait max for 8 hours
net->read_timeout=(uint) thd->variables.net_wait_timeout; net->read_timeout=(uint) thd->variables.net_wait_timeout;
net->last_error[0]=0; // Clear error message thd->clear_error(); // Clear error message
net->last_errno=0;
net_new_transaction(net); net_new_transaction(net);
if ((packet_length=my_net_read(net)) == packet_error) if ((packet_length=my_net_read(net)) == packet_error)
......
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