Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-20 01:20:38+04:00, kostja@bodhi.(none) +12 -0
Rename: query_error -> is_slave_error.
Add comments.
sql/ha_ndbcluster_binlog.cc@stripped, 2007-10-20 01:20:33+04:00, kostja@bodhi.(none) +2 -2
query_error -> slave_error
sql/handler.cc@stripped, 2007-10-20 01:20:33+04:00, kostja@bodhi.(none) +3 -3
query_error -> slave_error
sql/log.cc@stripped, 2007-10-20 01:20:34+04:00, kostja@bodhi.(none) +2 -2
query_error -> slave_error
sql/log_event.cc@stripped, 2007-10-20 01:20:34+04:00, kostja@bodhi.(none) +30 -24
query_error -> slave_error
sql/log_event_old.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +6 -6
query_error -> slave_error
sql/mysqld.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +1 -1
query_error -> slave_error
sql/protocol.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +2 -2
query_error -> slave_error
sql/slave.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +3 -3
query_error -> slave_error
sql/sp_head.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +3 -3
query_error -> slave_error
sql/sql_class.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +1 -1
query_error -> slave_error
sql/sql_class.h@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +9 -2
Rename: query_error -> is_slave_error, to avoid confusion.
Add commenta.
sql/sql_connect.cc@stripped, 2007-10-20 01:20:35+04:00, kostja@bodhi.(none) +1 -1
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.
diff -Nrup a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
--- a/sql/ha_ndbcluster_binlog.cc 2007-09-07 13:15:04 +04:00
+++ b/sql/ha_ndbcluster_binlog.cc 2007-10-20 01:20:33 +04:00
@@ -259,7 +259,7 @@ static void run_query(THD *thd, char *bu
DBUG_PRINT("query", ("%s", thd->query));
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;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -271,7 +271,7 @@ static void run_query(THD *thd, char *bu
sql_print_error("NDB: %s: error %s %d(ndb: %d) %d %d",
buf, thd->net.last_error, thd->net.last_errno,
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;
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc 2007-08-31 10:57:57 +04:00
+++ b/sql/handler.cc 2007-10-20 01:20:33 +04:00
@@ -1447,7 +1447,7 @@ int ha_delete_table(THD *thd, handlerton
(We should in the future either rewrite handler::print_error() or make
a nice method of this.
*/
- bool query_error= thd->query_error;
+ bool is_slave_error= thd->is_slave_error;
sp_rcontext *spcont= thd->spcont;
SELECT_LEX *current_select= thd->lex->current_select;
char buff[sizeof(thd->net.last_error)];
@@ -1455,7 +1455,7 @@ int ha_delete_table(THD *thd, handlerton
int last_errno= thd->net.last_errno;
strmake(buff, thd->net.last_error, sizeof(buff)-1);
- thd->query_error= 0;
+ thd->is_slave_error= 0;
thd->spcont= NULL;
thd->lex->current_select= 0;
thd->net.last_error[0]= 0;
@@ -1475,7 +1475,7 @@ int ha_delete_table(THD *thd, handlerton
strmake(new_error, thd->net.last_error, sizeof(buff)-1);
/* restore thd */
- thd->query_error= query_error;
+ thd->is_slave_error= is_slave_error;
thd->spcont= spcont;
thd->lex->current_select= current_select;
thd->net.last_errno= last_errno;
diff -Nrup a/sql/log.cc b/sql/log.cc
--- a/sql/log.cc 2007-10-18 22:45:04 +04:00
+++ b/sql/log.cc 2007-10-20 01:20:34 +04:00
@@ -2891,8 +2891,8 @@ int MYSQL_BIN_LOG::purge_logs(const char
*decrease_log_space-= file_size;
ha_binlog_index_purge_file(current_thd, log_info.log_file_name);
- if (current_thd->query_error) {
- DBUG_PRINT("info",("query error: %d", current_thd->query_error));
+ if (current_thd->is_slave_error) {
+ DBUG_PRINT("info",("slave error: %d", current_thd->is_slave_error));
if (my_errno == EMFILE) {
DBUG_PRINT("info",("my_errno: %d, set ret = LOG_INFO_EMFILE", my_errno));
ret = LOG_INFO_EMFILE;
diff -Nrup a/sql/log_event.cc b/sql/log_event.cc
--- a/sql/log_event.cc 2007-10-18 22:45:04 +04:00
+++ b/sql/log_event.cc 2007-10-20 01:20:34 +04:00
@@ -148,7 +148,7 @@ static void pretty_print_str(IO_CACHE* c
static void clear_all_errors(THD *thd, Relay_log_info *rli)
{
- thd->query_error = 0;
+ thd->is_slave_error = 0;
thd->clear_error();
rli->clear_error();
}
@@ -2106,7 +2106,7 @@ and was aborted. There is a chance that
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; \
START SLAVE; . Query: '%s'", expected_error, thd->query);
- thd->query_error= 1;
+ thd->is_slave_error= 1;
}
goto end;
}
@@ -2138,7 +2138,7 @@ Default database: '%s'. Query: '%s'",
actual_error ? thd->net.last_error: "no error",
actual_error,
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.
@@ -2153,14 +2153,14 @@ Default database: '%s'. Query: '%s'",
/*
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,
"Error '%s' on query. Default database: '%s'. Query: '%s'",
(actual_error ? thd->net.last_error :
"unexpected success or fatal error"),
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'",
sql_print_error("Slave: did not get the expected number of affected \
rows running query from master - expected %d, got %d (this numbers \
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"
mismatch. This mismatch could be implemented with a new ER_ code, and
@@ -2215,7 +2215,7 @@ end:
thd->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));
- return thd->query_error;
+ return thd->is_slave_error;
}
int Query_log_event::do_update_pos(Relay_log_info *rli)
@@ -3255,7 +3255,7 @@ int Load_log_event::do_apply_event(NET*
thd->set_db(new_db.str, new_db.length);
DBUG_ASSERT(thd->query == 0);
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));
/* see Query_log_event::do_apply_event() and BUG#13360 */
@@ -3429,7 +3429,7 @@ int Load_log_event::do_apply_event(NET*
List<Item> tmp_list;
if (mysql_load(thd, &ex, &tables, field_list, tmp_list, tmp_list,
handle_dup, ignore, net != 0))
- thd->query_error= 1;
+ thd->is_slave_error= 1;
if (thd->cuted_fields)
{
/* log_pos is the position of the LOAD event in the master log */
@@ -3468,9 +3468,9 @@ error:
close_thread_tables(thd);
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() */
const char *err;
@@ -5655,7 +5655,7 @@ Rows_log_event::Rows_log_event(THD *thd_
m_width(tbl_arg ? tbl_arg->s->fields : 1),
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0)
#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
{
/*
@@ -5703,7 +5703,7 @@ Rows_log_event::Rows_log_event(const cha
#endif
m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
#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
{
DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
@@ -5951,7 +5951,7 @@ int Rows_log_event::do_apply_event(Relay
{
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
@@ -5995,7 +5995,7 @@ int Rows_log_event::do_apply_event(Relay
uint tables_count= rli->tables_to_lock_count;
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
@@ -6006,7 +6006,7 @@ int Rows_log_event::do_apply_event(Relay
"Error '%s' on reopening tables",
(actual_error ? thd->net.last_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();
DBUG_RETURN(error);
@@ -6029,7 +6029,7 @@ int Rows_log_event::do_apply_event(Relay
{
mysql_unlock_tables(thd, thd->lock);
thd->lock= 0;
- thd->query_error= 1;
+ thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(ERR_BAD_TABLE_DEF);
}
@@ -6159,7 +6159,7 @@ int Rows_log_event::do_apply_event(Relay
"Error in %s event: row application failed. %s",
get_type_str(),
thd->net.last_error ? thd->net.last_error : "");
- thd->query_error= 1;
+ thd->is_slave_error= 1;
break;
}
@@ -6221,7 +6221,7 @@ int Rows_log_event::do_apply_event(Relay
*/
thd->reset_current_stmt_binlog_row_based();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
- thd->query_error= 1;
+ thd->is_slave_error= 1;
DBUG_RETURN(error);
}
@@ -6519,9 +6519,15 @@ Table_map_log_event::Table_map_log_event
m_dblen(m_dbnam ? tbl->s->db.length : 0),
m_tblnam(tbl->s->table_name.str),
m_tbllen(tbl->s->table_name.length),
- m_colcnt(tbl->s->fields), m_field_metadata(0),
- m_field_metadata_size(0), m_memory(NULL), m_meta_memory(NULL), m_data_size(0),
- m_table_id(tid), m_null_bits(0), m_flags(flags)
+ m_colcnt(tbl->s->fields),
+ m_memory(NULL),
+ 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);
/*
@@ -6798,7 +6804,7 @@ int Table_map_log_event::do_apply_event(
TABLE_LIST *tmp_table_list= table_list;
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
@@ -6810,7 +6816,7 @@ int Table_map_log_event::do_apply_event(
(actual_error ? thd->net.last_error :
"unexpected success or fatal error"),
table_list->db, table_list->table_name);
- thd->query_error= 1;
+ thd->is_slave_error= 1;
}
goto err;
}
diff -Nrup a/sql/log_event_old.cc b/sql/log_event_old.cc
--- a/sql/log_event_old.cc 2007-08-30 02:57:55 +04:00
+++ b/sql/log_event_old.cc 2007-10-20 01:20:35 +04:00
@@ -68,7 +68,7 @@ Old_rows_log_event::do_apply_event(Rows_
{
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
@@ -112,7 +112,7 @@ Old_rows_log_event::do_apply_event(Rows_
uint tables_count= rli->tables_to_lock_count;
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
@@ -123,7 +123,7 @@ Old_rows_log_event::do_apply_event(Rows_
"Error '%s' on reopening tables",
(actual_error ? thd->net.last_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();
DBUG_RETURN(error);
@@ -146,7 +146,7 @@ Old_rows_log_event::do_apply_event(Rows_
{
mysql_unlock_tables(thd, thd->lock);
thd->lock= 0;
- thd->query_error= 1;
+ thd->is_slave_error= 1;
const_cast<Relay_log_info*>(rli)->clear_tables_to_lock();
DBUG_RETURN(Rows_log_event::ERR_BAD_TABLE_DEF);
}
@@ -255,7 +255,7 @@ Old_rows_log_event::do_apply_event(Rows_
"Error in %s event: row application failed. %s",
ev->get_type_str(),
thd->net.last_error ? thd->net.last_error : "");
- thd->query_error= 1;
+ thd->is_slave_error= 1;
break;
}
@@ -300,7 +300,7 @@ Old_rows_log_event::do_apply_event(Rows_
*/
thd->reset_current_stmt_binlog_row_based();
const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
- thd->query_error= 1;
+ thd->is_slave_error= 1;
DBUG_RETURN(error);
}
diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc 2007-10-12 15:15:26 +04:00
+++ b/sql/mysqld.cc 2007-10-20 01:20:35 +04:00
@@ -2593,7 +2593,7 @@ int my_message_sql(uint error, const cha
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)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);
diff -Nrup a/sql/protocol.cc b/sql/protocol.cc
--- a/sql/protocol.cc 2007-10-15 15:45:16 +04:00
+++ b/sql/protocol.cc 2007-10-20 01:20:35 +04:00
@@ -84,7 +84,7 @@ void net_send_error(THD *thd, uint sql_e
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 (sql_errno)
@@ -162,7 +162,7 @@ net_printf_error(THD *thd, uint errcode,
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
query_cache_abort(net); // Safety
#endif
diff -Nrup a/sql/slave.cc b/sql/slave.cc
--- a/sql/slave.cc 2007-08-30 01:28:34 +04:00
+++ b/sql/slave.cc 2007-10-20 01:20:35 +04:00
@@ -980,7 +980,7 @@ static int create_table_from_dump(THD* t
DBUG_RETURN(1);
}
thd->query= query;
- thd->query_error = 0;
+ thd->is_slave_error = 0;
thd->net.no_send_ok = 1;
bzero((char*) &tables,sizeof(tables));
@@ -1009,7 +1009,7 @@ static int create_table_from_dump(THD* t
thd->db_length= save_db_length;
thd->options = save_options;
- if (thd->query_error)
+ if (thd->is_slave_error)
goto err; // mysql_parse took care of the error send
thd->proc_info = "Opening master dump table";
@@ -2501,7 +2501,7 @@ log '%s' at position %s, relay log '%s'
if (sys_init_slave.value_length)
{
execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave);
- if (thd->query_error)
+ if (thd->is_slave_error)
{
sql_print_error("\
Slave SQL thread aborted. Can't execute init_slave query");
diff -Nrup a/sql/sp_head.cc b/sql/sp_head.cc
--- a/sql/sp_head.cc 2007-10-18 22:47:17 +04:00
+++ b/sql/sp_head.cc 2007-10-20 01:20:35 +04:00
@@ -1108,7 +1108,7 @@ sp_head::execute(THD *thd)
if ((ctx= thd->spcont))
ctx->clear_handler();
- thd->query_error= 0;
+ thd->is_slave_error= 0;
old_arena= thd->stmt_arena;
/*
@@ -1275,8 +1275,8 @@ sp_head::execute(THD *thd)
state= EXECUTED;
done:
- DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d report_error: %d",
- err_status, thd->killed, thd->query_error,
+ DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d",
+ err_status, thd->killed, thd->is_slave_error,
thd->net.report_error));
if (thd->killed)
diff -Nrup a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc 2007-10-19 02:57:41 +04:00
+++ b/sql/sql_class.cc 2007-10-20 01:20:35 +04:00
@@ -395,7 +395,7 @@ THD::THD()
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
col_access=0;
- query_error= thread_specific_used= FALSE;
+ is_slave_error= thread_specific_used= FALSE;
hash_clear(&handler_tables_hash);
tmp_table=0;
used_tables=0;
diff -Nrup a/sql/sql_class.h b/sql/sql_class.h
--- a/sql/sql_class.h 2007-09-29 02:11:24 +04:00
+++ b/sql/sql_class.h 2007-10-20 01:20:35 +04:00
@@ -1466,7 +1466,14 @@ public:
/* for IS NULL => = last_insert_id() fix in remove_eq_conds() */
bool substitute_null_with_insert_id;
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. */
bool thread_specific_used;
@@ -1695,7 +1702,7 @@ public:
net.last_error[0]= 0;
net.last_errno= 0;
net.report_error= 0;
- query_error= 0;
+ is_slave_error= 0;
DBUG_VOID_RETURN;
}
inline bool vio_ok() const { return net.vio != 0; }
diff -Nrup a/sql/sql_connect.cc b/sql/sql_connect.cc
--- a/sql/sql_connect.cc 2007-10-10 17:56:58 +04:00
+++ b/sql/sql_connect.cc 2007-10-20 01:20:35 +04:00
@@ -1030,7 +1030,7 @@ static void prepare_new_connection_state
if (sys_init_connect.value_length && !(sctx->master_access & SUPER_ACL))
{
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;
sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
| Thread |
|---|
| • bk commit into 5.1 tree (kostja:1.2593) | konstantin | 19 Oct |