Commit 6b658b9f authored by unknown's avatar unknown

Rename: query_error -> is_slave_error.

Add comments.


sql/ha_ndbcluster_binlog.cc:
  query_error -> slave_error
sql/handler.cc:
  query_error -> slave_error
sql/log.cc:
  query_error -> slave_error
sql/log_event.cc:
  query_error -> slave_error
sql/log_event_old.cc:
  query_error -> slave_error
sql/mysqld.cc:
  query_error -> slave_error
sql/protocol.cc:
  query_error -> slave_error
sql/slave.cc:
  query_error -> slave_error
sql/sp_head.cc:
  query_error -> slave_error
sql/sql_class.cc:
  query_error -> slave_error
sql/sql_class.h:
  Rename: query_error -> is_slave_error, to avoid confusion.
  Add commenta.
sql/sql_connect.cc:
  Rename: query_error -> is_slave_error, to avoid confusion.
  Originally it was the same code to handle init-connect and init-slave 
  mysqld options. Then init-connect implementation forked off,
  but the one who copy-pasted the code didn't change it to not
  use a replication-specific variable.
parent 9248b192
...@@ -259,7 +259,7 @@ static void run_query(THD *thd, char *buf, char *end, ...@@ -259,7 +259,7 @@ static void run_query(THD *thd, char *buf, char *end,
DBUG_PRINT("query", ("%s", thd->query)); DBUG_PRINT("query", ("%s", thd->query));
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon); mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
if (no_print_error && thd->query_error) if (no_print_error && thd->is_slave_error)
{ {
int i; int i;
Thd_ndb *thd_ndb= get_thd_ndb(thd); Thd_ndb *thd_ndb= get_thd_ndb(thd);
...@@ -271,7 +271,7 @@ static void run_query(THD *thd, char *buf, char *end, ...@@ -271,7 +271,7 @@ static void run_query(THD *thd, char *buf, char *end,
sql_print_error("NDB: %s: error %s %d(ndb: %d) %d %d", sql_print_error("NDB: %s: error %s %d(ndb: %d) %d %d",
buf, thd->net.last_error, thd->net.last_errno, buf, thd->net.last_error, thd->net.last_errno,
thd_ndb->m_error_code, thd_ndb->m_error_code,
thd->net.report_error, thd->query_error); thd->net.report_error, thd->is_slave_error);
} }
thd->options= save_thd_options; thd->options= save_thd_options;
......
...@@ -1447,7 +1447,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, ...@@ -1447,7 +1447,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
(We should in the future either rewrite handler::print_error() or make (We should in the future either rewrite handler::print_error() or make
a nice method of this. a nice method of this.
*/ */
bool query_error= thd->query_error; bool is_slave_error= thd->is_slave_error;
sp_rcontext *spcont= thd->spcont; sp_rcontext *spcont= thd->spcont;
SELECT_LEX *current_select= thd->lex->current_select; SELECT_LEX *current_select= thd->lex->current_select;
char buff[sizeof(thd->net.last_error)]; char buff[sizeof(thd->net.last_error)];
...@@ -1455,7 +1455,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, ...@@ -1455,7 +1455,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
int last_errno= thd->net.last_errno; int last_errno= thd->net.last_errno;
strmake(buff, thd->net.last_error, sizeof(buff)-1); strmake(buff, thd->net.last_error, sizeof(buff)-1);
thd->query_error= 0; thd->is_slave_error= 0;
thd->spcont= NULL; thd->spcont= NULL;
thd->lex->current_select= 0; thd->lex->current_select= 0;
thd->net.last_error[0]= 0; thd->net.last_error[0]= 0;
...@@ -1475,7 +1475,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, ...@@ -1475,7 +1475,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
strmake(new_error, thd->net.last_error, sizeof(buff)-1); strmake(new_error, thd->net.last_error, sizeof(buff)-1);
/* restore thd */ /* restore thd */
thd->query_error= query_error; thd->is_slave_error= is_slave_error;
thd->spcont= spcont; thd->spcont= spcont;
thd->lex->current_select= current_select; thd->lex->current_select= current_select;
thd->net.last_errno= last_errno; thd->net.last_errno= last_errno;
......
...@@ -2891,8 +2891,8 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, ...@@ -2891,8 +2891,8 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
*decrease_log_space-= file_size; *decrease_log_space-= file_size;
ha_binlog_index_purge_file(current_thd, log_info.log_file_name); ha_binlog_index_purge_file(current_thd, log_info.log_file_name);
if (current_thd->query_error) { if (current_thd->is_slave_error) {
DBUG_PRINT("info",("query error: %d", current_thd->query_error)); DBUG_PRINT("info",("slave error: %d", current_thd->is_slave_error));
if (my_errno == EMFILE) { if (my_errno == EMFILE) {
DBUG_PRINT("info",("my_errno: %d, set ret = LOG_INFO_EMFILE", my_errno)); DBUG_PRINT("info",("my_errno: %d, set ret = LOG_INFO_EMFILE", my_errno));
ret = LOG_INFO_EMFILE; ret = LOG_INFO_EMFILE;
......
...@@ -148,7 +148,7 @@ static void pretty_print_str(IO_CACHE* cache, char* str, int len) ...@@ -148,7 +148,7 @@ static void pretty_print_str(IO_CACHE* cache, char* str, int len)
static void clear_all_errors(THD *thd, Relay_log_info *rli) static void clear_all_errors(THD *thd, Relay_log_info *rli)
{ {
thd->query_error = 0; thd->is_slave_error = 0;
thd->clear_error(); thd->clear_error();
rli->clear_error(); rli->clear_error();
} }
...@@ -2106,7 +2106,7 @@ and was aborted. There is a chance that your master is inconsistent at this \ ...@@ -2106,7 +2106,7 @@ and was aborted. There is a chance that your master is inconsistent at this \
point. If you are sure that your master is ok, run this query manually on the \ point. If you are sure that your master is ok, run this query manually on the \
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \ slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; \
START SLAVE; . Query: '%s'", expected_error, thd->query); START SLAVE; . Query: '%s'", expected_error, thd->query);
thd->query_error= 1; thd->is_slave_error= 1;
} }
goto end; goto end;
} }
...@@ -2138,7 +2138,7 @@ Default database: '%s'. Query: '%s'", ...@@ -2138,7 +2138,7 @@ Default database: '%s'. Query: '%s'",
actual_error ? thd->net.last_error: "no error", actual_error ? thd->net.last_error: "no error",
actual_error, actual_error,
print_slave_db_safe(db), query_arg); print_slave_db_safe(db), query_arg);
thd->query_error= 1; thd->is_slave_error= 1;
} }
/* /*
If we get the same error code as expected, or they should be ignored. If we get the same error code as expected, or they should be ignored.
...@@ -2153,14 +2153,14 @@ Default database: '%s'. Query: '%s'", ...@@ -2153,14 +2153,14 @@ Default database: '%s'. Query: '%s'",
/* /*
Other cases: mostly we expected no error and get one. Other cases: mostly we expected no error and get one.
*/ */
else if (thd->query_error || thd->is_fatal_error) else if (thd->is_slave_error || thd->is_fatal_error)
{ {
rli->report(ERROR_LEVEL, actual_error, rli->report(ERROR_LEVEL, actual_error,
"Error '%s' on query. Default database: '%s'. Query: '%s'", "Error '%s' on query. Default database: '%s'. Query: '%s'",
(actual_error ? thd->net.last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error"), "unexpected success or fatal error"),
print_slave_db_safe(thd->db), query_arg); print_slave_db_safe(thd->db), query_arg);
thd->query_error= 1; thd->is_slave_error= 1;
} }
/* /*
...@@ -2171,7 +2171,7 @@ Default database: '%s'. Query: '%s'", ...@@ -2171,7 +2171,7 @@ Default database: '%s'. Query: '%s'",
sql_print_error("Slave: did not get the expected number of affected \ sql_print_error("Slave: did not get the expected number of affected \
rows running query from master - expected %d, got %d (this numbers \ rows running query from master - expected %d, got %d (this numbers \
should have matched modulo 4294967296).", 0, ...); should have matched modulo 4294967296).", 0, ...);
thd->query_error = 1; thd->is_slave_error = 1;
} }
We may also want an option to tell the slave to ignore "affected" We may also want an option to tell the slave to ignore "affected"
mismatch. This mismatch could be implemented with a new ER_ code, and mismatch. This mismatch could be implemented with a new ER_ code, and
...@@ -2215,7 +2215,7 @@ Default database: '%s'. Query: '%s'", ...@@ -2215,7 +2215,7 @@ Default database: '%s'. Query: '%s'",
thd->first_successful_insert_id_in_prev_stmt= 0; thd->first_successful_insert_id_in_prev_stmt= 0;
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
return thd->query_error; return thd->is_slave_error;
} }
int Query_log_event::do_update_pos(Relay_log_info *rli) int Query_log_event::do_update_pos(Relay_log_info *rli)
...@@ -3255,7 +3255,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli, ...@@ -3255,7 +3255,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
thd->set_db(new_db.str, new_db.length); thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query == 0); DBUG_ASSERT(thd->query == 0);
thd->query_length= 0; // Should not be needed thd->query_length= 0; // Should not be needed
thd->query_error= 0; thd->is_slave_error= 0;
clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
/* see Query_log_event::do_apply_event() and BUG#13360 */ /* see Query_log_event::do_apply_event() and BUG#13360 */
...@@ -3429,7 +3429,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli, ...@@ -3429,7 +3429,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
List<Item> tmp_list; List<Item> tmp_list;
if (mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list, if (mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
handle_dup, ignore, net != 0)) handle_dup, ignore, net != 0))
thd->query_error= 1; thd->is_slave_error= 1;
if (thd->cuted_fields) if (thd->cuted_fields)
{ {
/* log_pos is the position of the LOAD event in the master log */ /* log_pos is the position of the LOAD event in the master log */
...@@ -3468,9 +3468,9 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli, ...@@ -3468,9 +3468,9 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
close_thread_tables(thd); close_thread_tables(thd);
DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",
thd->query_error= 0; thd->is_fatal_error= 1;); thd->is_slave_error= 0; thd->is_fatal_error= 1;);
if (thd->query_error) if (thd->is_slave_error)
{ {
/* this err/sql_errno code is copy-paste from net_send_error() */ /* this err/sql_errno code is copy-paste from net_send_error() */
const char *err; const char *err;
...@@ -5655,7 +5655,7 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, ...@@ -5655,7 +5655,7 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
m_width(tbl_arg ? tbl_arg->s->fields : 1), m_width(tbl_arg ? tbl_arg->s->fields : 1),
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0) m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0)
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
,m_key(NULL), m_curr_row(NULL), m_curr_row_end(NULL) , m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL)
#endif #endif
{ {
/* /*
...@@ -5703,7 +5703,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, ...@@ -5703,7 +5703,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
#endif #endif
m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0) m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
,m_key(NULL), m_curr_row(NULL), m_curr_row_end(NULL) , m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL)
#endif #endif
{ {
DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)"); DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
...@@ -5951,7 +5951,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -5951,7 +5951,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
{ {
if (!need_reopen) if (!need_reopen)
{ {
if (thd->query_error || thd->is_fatal_error) if (thd->is_slave_error || thd->is_fatal_error)
{ {
/* /*
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
...@@ -5995,7 +5995,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -5995,7 +5995,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
uint tables_count= rli->tables_to_lock_count; uint tables_count= rli->tables_to_lock_count;
if ((error= open_tables(thd, &tables, &tables_count, 0))) if ((error= open_tables(thd, &tables, &tables_count, 0)))
{ {
if (thd->query_error || thd->is_fatal_error) if (thd->is_slave_error || thd->is_fatal_error)
{ {
/* /*
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
...@@ -6006,7 +6006,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6006,7 +6006,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
"Error '%s' on reopening tables", "Error '%s' on reopening tables",
(actual_error ? thd->net.last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error")); "unexpected success or fatal error"));
thd->query_error= 1; thd->is_slave_error= 1;
} }
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -6029,7 +6029,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6029,7 +6029,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
{ {
mysql_unlock_tables(thd, thd->lock); mysql_unlock_tables(thd, thd->lock);
thd->lock= 0; thd->lock= 0;
thd->query_error= 1; thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(ERR_BAD_TABLE_DEF); DBUG_RETURN(ERR_BAD_TABLE_DEF);
} }
...@@ -6159,7 +6159,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6159,7 +6159,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
"Error in %s event: row application failed. %s", "Error in %s event: row application failed. %s",
get_type_str(), get_type_str(),
thd->net.last_error ? thd->net.last_error : ""); thd->net.last_error ? thd->net.last_error : "");
thd->query_error= 1; thd->is_slave_error= 1;
break; break;
} }
...@@ -6221,7 +6221,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6221,7 +6221,7 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
*/ */
thd->reset_current_stmt_binlog_row_based(); thd->reset_current_stmt_binlog_row_based();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error); const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
thd->query_error= 1; thd->is_slave_error= 1;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -6519,9 +6519,15 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, ...@@ -6519,9 +6519,15 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_dblen(m_dbnam ? tbl->s->db.length : 0), m_dblen(m_dbnam ? tbl->s->db.length : 0),
m_tblnam(tbl->s->table_name.str), m_tblnam(tbl->s->table_name.str),
m_tbllen(tbl->s->table_name.length), m_tbllen(tbl->s->table_name.length),
m_colcnt(tbl->s->fields), m_field_metadata(0), m_colcnt(tbl->s->fields),
m_field_metadata_size(0), m_memory(NULL), m_meta_memory(NULL), m_data_size(0), m_memory(NULL),
m_table_id(tid), m_null_bits(0), m_flags(flags) m_table_id(tid),
m_flags(flags),
m_data_size(0),
m_field_metadata(0),
m_field_metadata_size(0),
m_null_bits(0),
m_meta_memory(NULL)
{ {
DBUG_ASSERT(m_table_id != ~0UL); DBUG_ASSERT(m_table_id != ~0UL);
/* /*
...@@ -6798,7 +6804,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6798,7 +6804,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
TABLE_LIST *tmp_table_list= table_list; TABLE_LIST *tmp_table_list= table_list;
if ((error= open_tables(thd, &tmp_table_list, &count, 0))) if ((error= open_tables(thd, &tmp_table_list, &count, 0)))
{ {
if (thd->query_error || thd->is_fatal_error) if (thd->is_slave_error || thd->is_fatal_error)
{ {
/* /*
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
...@@ -6810,7 +6816,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli) ...@@ -6810,7 +6816,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
(actual_error ? thd->net.last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error"), "unexpected success or fatal error"),
table_list->db, table_list->table_name); table_list->db, table_list->table_name);
thd->query_error= 1; thd->is_slave_error= 1;
} }
goto err; goto err;
} }
......
...@@ -68,7 +68,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -68,7 +68,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
{ {
if (!need_reopen) if (!need_reopen)
{ {
if (thd->query_error || thd->is_fatal_error) if (thd->is_slave_error || thd->is_fatal_error)
{ {
/* /*
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
...@@ -112,7 +112,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -112,7 +112,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
uint tables_count= rli->tables_to_lock_count; uint tables_count= rli->tables_to_lock_count;
if ((error= open_tables(thd, &tables, &tables_count, 0))) if ((error= open_tables(thd, &tables, &tables_count, 0)))
{ {
if (thd->query_error || thd->is_fatal_error) if (thd->is_slave_error || thd->is_fatal_error)
{ {
/* /*
Error reporting borrowed from Query_log_event with many excessive Error reporting borrowed from Query_log_event with many excessive
...@@ -123,7 +123,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -123,7 +123,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
"Error '%s' on reopening tables", "Error '%s' on reopening tables",
(actual_error ? thd->net.last_error : (actual_error ? thd->net.last_error :
"unexpected success or fatal error")); "unexpected success or fatal error"));
thd->query_error= 1; thd->is_slave_error= 1;
} }
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -146,7 +146,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -146,7 +146,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
{ {
mysql_unlock_tables(thd, thd->lock); mysql_unlock_tables(thd, thd->lock);
thd->lock= 0; thd->lock= 0;
thd->query_error= 1; thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock(); const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(Rows_log_event::ERR_BAD_TABLE_DEF); DBUG_RETURN(Rows_log_event::ERR_BAD_TABLE_DEF);
} }
...@@ -255,7 +255,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -255,7 +255,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
"Error in %s event: row application failed. %s", "Error in %s event: row application failed. %s",
ev->get_type_str(), ev->get_type_str(),
thd->net.last_error ? thd->net.last_error : ""); thd->net.last_error ? thd->net.last_error : "");
thd->query_error= 1; thd->is_slave_error= 1;
break; break;
} }
...@@ -300,7 +300,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli ...@@ -300,7 +300,7 @@ Old_rows_log_event::do_apply_event(Rows_log_event *ev, const Relay_log_info *rli
*/ */
thd->reset_current_stmt_binlog_row_based(); thd->reset_current_stmt_binlog_row_based();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error); const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
thd->query_error= 1; thd->is_slave_error= 1;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -2593,7 +2593,7 @@ int my_message_sql(uint error, const char *str, myf MyFlags) ...@@ -2593,7 +2593,7 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
thd->query_error= 1; // needed to catch query errors during replication thd->is_slave_error= 1; // needed to catch query errors during replication
if (!thd->no_warnings_for_error) if (!thd->no_warnings_for_error)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);
......
...@@ -84,7 +84,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) ...@@ -84,7 +84,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
thd->query_error= 1; // needed to catch query errors during replication thd->is_slave_error= 1; // needed to catch query errors during replication
if (!err) if (!err)
{ {
if (sql_errno) if (sql_errno)
...@@ -162,7 +162,7 @@ net_printf_error(THD *thd, uint errcode, ...) ...@@ -162,7 +162,7 @@ net_printf_error(THD *thd, uint errcode, ...)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
thd->query_error= 1; // needed to catch query errors during replication thd->is_slave_error= 1; // needed to catch query errors during replication
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
query_cache_abort(net); // Safety query_cache_abort(net); // Safety
#endif #endif
......
...@@ -980,7 +980,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, ...@@ -980,7 +980,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->query= query; thd->query= query;
thd->query_error = 0; thd->is_slave_error = 0;
thd->net.no_send_ok = 1; thd->net.no_send_ok = 1;
bzero((char*) &tables,sizeof(tables)); bzero((char*) &tables,sizeof(tables));
...@@ -1009,7 +1009,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, ...@@ -1009,7 +1009,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
thd->db_length= save_db_length; thd->db_length= save_db_length;
thd->options = save_options; thd->options = save_options;
if (thd->query_error) if (thd->is_slave_error)
goto err; // mysql_parse took care of the error send goto err; // mysql_parse took care of the error send
thd->proc_info = "Opening master dump table"; thd->proc_info = "Opening master dump table";
...@@ -2501,7 +2501,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, ...@@ -2501,7 +2501,7 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
if (sys_init_slave.value_length) if (sys_init_slave.value_length)
{ {
execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave); execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave);
if (thd->query_error) if (thd->is_slave_error)
{ {
sql_print_error("\ sql_print_error("\
Slave SQL thread aborted. Can't execute init_slave query"); Slave SQL thread aborted. Can't execute init_slave query");
......
...@@ -1108,7 +1108,7 @@ sp_head::execute(THD *thd) ...@@ -1108,7 +1108,7 @@ sp_head::execute(THD *thd)
if ((ctx= thd->spcont)) if ((ctx= thd->spcont))
ctx->clear_handler(); ctx->clear_handler();
thd->query_error= 0; thd->is_slave_error= 0;
old_arena= thd->stmt_arena; old_arena= thd->stmt_arena;
/* /*
...@@ -1275,8 +1275,8 @@ sp_head::execute(THD *thd) ...@@ -1275,8 +1275,8 @@ sp_head::execute(THD *thd)
state= EXECUTED; state= EXECUTED;
done: done:
DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d report_error: %d", DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d",
err_status, thd->killed, thd->query_error, err_status, thd->killed, thd->is_slave_error,
thd->net.report_error)); thd->net.report_error));
if (thd->killed) if (thd->killed)
......
...@@ -395,7 +395,7 @@ THD::THD() ...@@ -395,7 +395,7 @@ THD::THD()
count_cuted_fields= CHECK_FIELD_IGNORE; count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED; killed= NOT_KILLED;
col_access=0; col_access=0;
query_error= thread_specific_used= FALSE; is_slave_error= thread_specific_used= FALSE;
hash_clear(&handler_tables_hash); hash_clear(&handler_tables_hash);
tmp_table=0; tmp_table=0;
used_tables=0; used_tables=0;
......
...@@ -1466,7 +1466,14 @@ class THD :public Statement, ...@@ -1466,7 +1466,14 @@ class THD :public Statement,
/* for IS NULL => = last_insert_id() fix in remove_eq_conds() */ /* for IS NULL => = last_insert_id() fix in remove_eq_conds() */
bool substitute_null_with_insert_id; bool substitute_null_with_insert_id;
bool in_lock_tables; bool in_lock_tables;
bool query_error, bootstrap, cleanup_done; /**
True if a slave error. Causes the slave to stop. Not the same
as the statement execution error (net.report_error), since
a statement may be expected to return an error, e.g. because
it returned an error on master, and this is OK on the slave.
*/
bool is_slave_error;
bool bootstrap, cleanup_done;
/** is set if some thread specific value(s) used in a statement. */ /** is set if some thread specific value(s) used in a statement. */
bool thread_specific_used; bool thread_specific_used;
...@@ -1695,7 +1702,7 @@ class THD :public Statement, ...@@ -1695,7 +1702,7 @@ class THD :public Statement,
net.last_error[0]= 0; net.last_error[0]= 0;
net.last_errno= 0; net.last_errno= 0;
net.report_error= 0; net.report_error= 0;
query_error= 0; is_slave_error= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
inline bool vio_ok() const { return net.vio != 0; } inline bool vio_ok() const { return net.vio != 0; }
......
...@@ -1030,7 +1030,7 @@ static void prepare_new_connection_state(THD* thd) ...@@ -1030,7 +1030,7 @@ static void prepare_new_connection_state(THD* thd)
if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL)) if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL))
{ {
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect); execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
if (thd->query_error) if (thd->net.report_error)
{ {
thd->killed= THD::KILL_CONNECTION; thd->killed= THD::KILL_CONNECTION;
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION), sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
......
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