Below is the list of changes that have just been committed into a local
5.1 repository of guilhem. When guilhem 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
1.1980 05/12/06 11:13:16 guilhem@stripped +17 -0
WL#1012 1) Fix for BUG#14082 "rpl_row_relayrotate: transaction NOT restarted at the
right place using RBR":
Rows_log_event::exec_event needs to call Log_event::event to properly increase binlog
and relay log coordinates (old code
increased them even though in a transaction). Re-enabling rpl_relayrotate, merging
rpl_(stm|row)_relayrotate into rpl_relayrotate.
2) old problem that a truncated binlog led to an error in SHOW SLAVE STATUS's Last_error
while with XA it is now safe,
introducing slave_print_msg to be able to print info, warning, or error (and report in
Last_error only if it's an error).
3) slave now tests thd->transaction.all.nht instead of
OPTION_BEGIN+opt_using_transactions, this is more accurate
4) TRANS_END_F -> STMT_END_F as the flag is actually used at the end of every
statement.
Testsuite failures status: SBR bdb-deadlock(DueToBDB) binlog_stm_mix_innodb_myisam, RBR
bdb-deadlock(DueToBDB) binlog_row_mix_innodb_myisam index_merge_bdb(DueToBDB)
information_schema_db multi_update(DueToBDB) sp_trans
wl1012-review-pending-comments.txt
1.13 05/12/06 11:13:10 guilhem@stripped +4 -2
small updates on what is done in this cset (this file is out-of-date anyway)
sql/sql_class.h
1.272 05/12/06 11:13:10 guilhem@stripped +1 -1
argument name change
mysql-test/t/rpl_relayrotate.test
1.6 05/12/06 11:13:10 guilhem@stripped +2 -5
Test does require InnoDB.
mysql-test/r/rpl_relayrotate.result
1.21 05/12/06 11:13:10 guilhem@stripped +0 -3
result update
mysql-test/extra/rpl_tests/rpl_relayrotate.test
1.22 05/12/06 11:13:10 guilhem@stripped +0 -4
SHOW SLAVE STATUS unneeded, only the presence of "8000" in the result matters. This
suppression
allows re-enabling the test (fix for BUG#12429 but that bug will be fixed more
completely by Matthias),
and also makes the result independent of row-based or statement-based.
This file is now used for row-based and statement-based.
sql/sql_class.cc
1.224 05/12/06 11:13:09 guilhem@stripped +4 -4
the trans_end argument should rather be named stmt_end, since
THD::binlog_flush_pending_rows_event
is called with parameter TRUE at the end of every *statement*.
sql/slave.h
1.94 05/12/06 11:13:09 guilhem@stripped +2 -1
slave_print_error -> slave_print_msg(enum loglevel,)
sql/slave.cc
1.259 05/12/06 11:13:09 guilhem@stripped +40 -18
slave_print_error becomes slave_print_msg: slave_print_msg takes a level (like
vprint_msg_to_log)
and, only if the level is ERROR_LEVEL, reports the error in SHOW SLAVE STATUS.
sql/log_event.h
1.142 05/12/06 11:13:09 guilhem@stripped +2 -2
flag is renamed as it is actually used at the end of each statement
sql/log_event.cc
1.195 05/12/06 11:13:09 guilhem@stripped +105 -124
1) slave used OPTION_BEGIN+opt_using_transactions to know if it was in a transaction;
much simpler and accurate to use thd->transaction.all.nht;
opt_using_transactions only says if slave supports >=1 transactional storage
engine, but this is too vague to know: slave may support only BDB,
so opt_using_transactions==1, table on master may be InnoDB and may be MyISAM on
slave, and then
slave would think it is in a transaction while it's not, thus wrongly restarting from
the BEGIN.
2) when slave founds a Format_description_log_event after a BEGIN, it means binlog was
cut by a crash;
we used to call slave_print_error() but it's excessive: XA makes this situation safe
so we shouldn't report on
this on Last_error and Last_errno of SHOW SLAVE STATUS; introducing slave_print_msg()
for that. In this scenario
we also need to unlock+close tables and thus clear RBR table mappings.
3) in RBR code, replacing clear_tables+close_thread_tables by
Table_map_log_event::cleanup.
4) Executing a Rows_log_event needs to call Log_event::exec_event(), which will NOT
step Exec_master_log_pos
if in a transaction (the old code ignored the transaction case and caused BUG#14082).
mysql-test/t/rpl_row_create_table.test
1.2 05/12/06 11:13:09 guilhem@stripped +5 -5
switching from BDB to MERGE, as BDB is disabled with --valgrind (which triggers
fallback to MyISAM and test failure)
mysql-test/t/disabled.def
1.16 05/12/06 11:13:09 guilhem@stripped +0 -2
BUG#14082 is fixed. BUG#12429 can be fixed by just removing SHOW SLAVE STATUS in
rpl_relayrotate, that's what I do here; Matthias will re-fix in 5.0 maybe.
mysql-test/r/rpl_row_create_table.result
1.2 05/12/06 11:13:09 guilhem@stripped +16 -16
result update
mysql-test/r/rpl_relayrotate.result
1.20 05/12/03 15:42:27 guilhem@stripped +0 -0
Rename: mysql-test/r/rpl_stm_relayrotate.result ->
mysql-test/r/rpl_relayrotate.result
mysql-test/t/rpl_relayrotate.test
1.5 05/12/03 15:41:48 guilhem@stripped +0 -0
Rename: mysql-test/t/rpl_stm_relayrotate.test -> mysql-test/t/rpl_relayrotate.test
mysql-test/t/rpl_relayrotate-slave.opt
1.6 05/12/03 15:41:41 guilhem@stripped +0 -0
Rename: mysql-test/t/rpl_stm_relayrotate-slave.opt ->
mysql-test/t/rpl_relayrotate-slave.opt
BitKeeper/deleted/.del-rpl_row_relayrotate-slave.opt~5ec3662a5f9526f0
1.3 05/12/03 15:41:18 guilhem@stripped +0 -0
Delete: mysql-test/t/rpl_row_relayrotate-slave.opt
BitKeeper/deleted/.del-rpl_row_relayrotate.test~c411ee17c14c9ced
1.5 05/12/03 15:41:14 guilhem@stripped +4 -4
Delete: mysql-test/t/rpl_row_relayrotate.test
mysql-test/extra/rpl_tests/rpl_relayrotate.test
1.21 05/12/03 15:35:35 guilhem@stripped +0 -0
Rename: mysql-test/extra/rpl_tests/rpl_stm_relayrotate.test ->
mysql-test/extra/rpl_tests/rpl_relayrotate.test
BitKeeper/deleted/.del-rpl_row_relayrotate.test~c42d04bb4781bd54
1.6 05/12/03 15:35:25 guilhem@stripped +2 -1
Delete: mysql-test/extra/rpl_tests/rpl_row_relayrotate.test
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: guilhem
# Host: gbichot3.local
# Root: /home/mysql_src/mysql-5.1
--- 1.194/sql/log_event.cc 2005-11-29 19:45:49 +01:00
+++ 1.195/sql/log_event.cc 2005-12-06 11:13:09 +01:00
@@ -415,31 +415,15 @@
if (rli)
{
/*
- If in a transaction, and if the slave supports transactions, just
- inc_event_relay_log_pos(). We only have to check for OPTION_BEGIN
- (not OPTION_NOT_AUTOCOMMIT) as transactions are logged with
- BEGIN/COMMIT, not with SET AUTOCOMMIT= .
-
- CAUTION: opt_using_transactions means
- innodb || bdb ; suppose the master supports InnoDB and BDB,
- but the slave supports only BDB, problems
- will arise:
- - suppose an InnoDB table is created on the master,
- - then it will be MyISAM on the slave
- - but as opt_using_transactions is true, the slave will believe he
- is transactional with the MyISAM table. And problems will come
- when one does START SLAVE; STOP SLAVE; START SLAVE; (the slave
- will resume at BEGIN whereas there has not been any rollback).
- This is the problem of using opt_using_transactions instead of a
- finer "does the slave support
- _the_transactional_handler_used_on_the_master_".
+ If this slave thread is in a transaction, just
+ inc_event_relay_log_pos().
- More generally, we'll have problems when a query mixes a
+ We'll have problems when a query mixes a
transactional handler and MyISAM and STOP SLAVE is issued in the
middle of the "transaction". START SLAVE will resume at BEGIN
while the MyISAM table has already been updated.
*/
- if ((thd->options & OPTION_BEGIN) && opt_using_transactions)
+ if (thd->transaction.all.nht)
rli->inc_event_relay_log_pos();
else
{
@@ -1733,7 +1717,7 @@
clear_all_errors(thd, rli); /* Can ignore query */
else
{
- slave_print_error(rli,expected_error,
+ slave_print_msg(ERROR_LEVEL, rli, expected_error,
"\
Query partially completed on the master (error on master: %d) \
and was aborted. There is a chance that your master is inconsistent at this \
@@ -1762,16 +1746,16 @@
!ignored_error_code(actual_error) &&
!ignored_error_code(expected_error))
{
- slave_print_error(rli, 0,
- "\
-Query caused different errors on master and slave. \
+ slave_print_msg(ERROR_LEVEL, rli, 0,
+ "\
+Query caused different errors on master and slave. \
Error on master: '%s' (%d), Error on slave: '%s' (%d). \
Default database: '%s'. Query: '%s'",
- ER_SAFE(expected_error),
- expected_error,
- actual_error ? thd->net.last_error: "no error",
- actual_error,
- print_slave_db_safe(db), query_arg);
+ ER_SAFE(expected_error),
+ expected_error,
+ actual_error ? thd->net.last_error: "no error",
+ actual_error,
+ print_slave_db_safe(db), query_arg);
thd->query_error= 1;
}
/*
@@ -1788,11 +1772,11 @@
*/
else if (thd->query_error || thd->is_fatal_error)
{
- slave_print_error(rli,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);
+ slave_print_msg(ERROR_LEVEL, rli, 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;
}
@@ -2212,10 +2196,8 @@
As a transaction NEVER spans on 2 or more binlogs:
if we have an active transaction at this point, the master died
while writing the transaction to the binary log, i.e. while
- flushing the binlog cache to the binlog. As the write was started,
- the transaction had been committed on the master, so we lack of
- information to replay this transaction on the slave; all we can do
- is stop with error.
+ flushing the binlog cache to the binlog. XA guarantees that master has
+ rolled back. So we roll back.
Note: this event could be sent by the master to inform us of the
format of its binlog; in other words maybe it is not at its
original place when it comes to us; we'll know this by checking
@@ -2223,11 +2205,18 @@
*/
if (!artificial_event && created && thd->transaction.all.nht)
{
- slave_print_error(rli, 0, "Rolling back unfinished transaction (no "
- "COMMIT or ROLLBACK) from relay log. A probable cause "
- "is that the master died while writing the transaction "
- "to its binary log.");
+ /* This is not an error (XA is safe), just an information */
+ slave_print_msg(INFORMATION_LEVEL, rli, 0,
+ "Rolling back unfinished transaction (no COMMIT "
+ "or ROLLBACK in relay log). A probable cause is that "
+ "the master died while writing the transaction to "
+ "its binary log, thus rolled back too.");
end_trans(thd, ROLLBACK);
+ close_thread_tables(thd); // some tables may be open, must close them
+ /* we also need to clear table mappings as tables are closed: */
+#ifdef HAVE_ROW_BASED_REPLICATION
+ Table_map_log_event::cleanup(thd, rli);
+#endif
}
#endif
/*
@@ -2244,7 +2233,7 @@
Stop_log_event::exec_event().
If in a transaction, don't touch group_* coordinates.
*/
- if (thd->options & OPTION_BEGIN)
+ if (thd->transaction.all.nht)
rli->inc_event_relay_log_pos();
else
{
@@ -2988,9 +2977,9 @@
sql_errno=ER_UNKNOWN_ERROR;
err=ER(sql_errno);
}
- slave_print_error(rli,sql_errno,"\
+ slave_print_msg(ERROR_LEVEL, rli, sql_errno,"\
Error '%s' running LOAD DATA INFILE on table '%s'. Default database: '%s'",
- err, (char*)table_name, print_slave_db_safe(save_db));
+ err, (char*)table_name, print_slave_db_safe(save_db));
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
return 1;
}
@@ -2998,9 +2987,9 @@
if (thd->is_fatal_error)
{
- slave_print_error(rli,ER_UNKNOWN_ERROR, "\
+ slave_print_msg(ERROR_LEVEL, rli, ER_UNKNOWN_ERROR, "\
Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'",
- (char*)table_name, print_slave_db_safe(save_db));
+ (char*)table_name, print_slave_db_safe(save_db));
return 1;
}
@@ -3160,7 +3149,7 @@
Starting from 5.0.0, there also are some rotates from the slave itself, in
the relay log.
*/
- if (!(thd->options & OPTION_BEGIN))
+ if (!thd->transaction.all.nht)
{
memcpy(rli->group_master_log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update();
@@ -3984,7 +3973,7 @@
could give false triggers in MASTER_POS_WAIT() that we have reached
the target position when in fact we have not.
*/
- if (thd->options & OPTION_BEGIN)
+ if (thd->transaction.all.nht)
rli->inc_event_relay_log_pos();
else
{
@@ -4205,7 +4194,8 @@
init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP)))
{
- slave_print_error(rli,my_errno, "Error in Create_file event: could not open file
'%s'", fname_buf);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+ "could not open file '%s'", fname_buf);
goto err;
}
@@ -4216,9 +4206,9 @@
if (write_base(&file))
{
strmov(p, ".info"); // to have it right in the error message
- slave_print_error(rli,my_errno,
- "Error in Create_file event: could not write to file '%s'",
- fname_buf);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno,
+ "Error in Create_file event: could not write to file '%s'",
+ fname_buf);
goto err;
}
end_io_cache(&file);
@@ -4230,12 +4220,14 @@
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0)
{
- slave_print_error(rli,my_errno, "Error in Create_file event: could not open file
'%s'", fname_buf);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+ "could not open file '%s'", fname_buf);
goto err;
}
if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
{
- slave_print_error(rli,my_errno, "Error in Create_file event: write to '%s' failed",
fname_buf);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Create_file event: "
+ "write to '%s' failed", fname_buf);
goto err;
}
error=0; // Everything is ok
@@ -4374,25 +4366,25 @@
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
MYF(MY_WME))) < 0)
{
- slave_print_error(rli, my_errno,
- "Error in %s event: could not create file '%s'",
- get_type_str(), fname);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno,
+ "Error in %s event: could not create file '%s'",
+ get_type_str(), fname);
goto err;
}
}
else if ((fd = my_open(fname, O_WRONLY | O_APPEND | O_BINARY | O_NOFOLLOW,
MYF(MY_WME))) < 0)
{
- slave_print_error(rli, my_errno,
- "Error in %s event: could not open file '%s'",
- get_type_str(), fname);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno,
+ "Error in %s event: could not open file '%s'",
+ get_type_str(), fname);
goto err;
}
if (my_write(fd, (byte*) block, block_len, MYF(MY_WME+MY_NABP)))
{
- slave_print_error(rli, my_errno,
- "Error in %s event: write to '%s' failed",
- get_type_str(), fname);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno,
+ "Error in %s event: write to '%s' failed",
+ get_type_str(), fname);
goto err;
}
error=0;
@@ -4599,7 +4591,8 @@
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
MYF(MY_WME|MY_NABP)))
{
- slave_print_error(rli,my_errno, "Error in Exec_load event: could not open file '%s'",
fname);
+ slave_print_msg(ERROR_LEVEL, rli, my_errno, "Error in Exec_load event: "
+ "could not open file '%s'", fname);
goto err;
}
if (!(lev = (Load_log_event*)Log_event::read_log_event(&file,
@@ -4607,7 +4600,8 @@
rli->relay_log.description_event_for_exec)) ||
lev->get_type_code() != NEW_LOAD_EVENT)
{
- slave_print_error(rli,0, "Error in Exec_load event: file '%s' appears corrupted",
fname);
+ slave_print_msg(ERROR_LEVEL, rli, 0, "Error in Exec_load event: "
+ "file '%s' appears corrupted", fname);
goto err;
}
@@ -4633,10 +4627,10 @@
char *tmp= my_strdup(rli->last_slave_error,MYF(MY_WME));
if (tmp)
{
- slave_print_error(rli,
- rli->last_slave_errno, /* ok to re-use error code */
- "%s. Failed executing load from '%s'",
- tmp, fname);
+ slave_print_msg(ERROR_LEVEL, rli,
+ rli->last_slave_errno, /* ok to re-use error code */
+ "%s. Failed executing load from '%s'",
+ tmp, fname);
my_free(tmp,MYF(0));
}
goto err;
@@ -4842,7 +4836,7 @@
if (!(buf = my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) +
(FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME))))
{
- slave_print_error(rli, my_errno, "Not enough memory");
+ slave_print_msg(ERROR_LEVEL, rli, my_errno, "Not enough memory");
return 1;
}
@@ -5205,9 +5199,9 @@
break;
if (!need_reopen)
{
- slave_print_error(rli, error,
- "Error in %s event: error during table %s.%s lock",
- get_type_str(), table->s->db,
table->s->table_name);
+ slave_print_msg(ERROR_LEVEL, rli, error,
+ "Error in %s event: error during table %s.%s lock",
+ get_type_str(), table->s->db, table->s->table_name);
DBUG_RETURN(error);
}
/*
@@ -5260,11 +5254,11 @@
simplifications (we don't honour --slave-skip-errors)
*/
uint actual_error= thd->net.last_errno;
- slave_print_error(rli,actual_error,
- "Error '%s' on reopening table `%s`.`%s`",
- (actual_error ? thd->net.last_error :
- "unexpected success or fatal error"),
- db, table_name);
+ slave_print_msg(ERROR_LEVEL, rli, actual_error,
+ "Error '%s' on reopening table `%s`.`%s`",
+ (actual_error ? thd->net.last_error :
+ "unexpected success or fatal error"),
+ db, table_name);
thd->query_error= 1;
}
}
@@ -5323,9 +5317,9 @@
break;
default:
- slave_print_error(rli, error,
- "Error in %s event: row application failed",
- get_type_str());
+ slave_print_msg(ERROR_LEVEL, rli, error,
+ "Error in %s event: row application failed",
+ get_type_str());
thd->query_error= 1;
break;
}
@@ -5337,7 +5331,6 @@
if (error)
{ /* error has occured during the transaction */
- rli->m_table_map.clear_tables();
/*
We do the two next calls to be sure to rollback whether it was
autocommit or in a transaction.
@@ -5346,24 +5339,19 @@
close tables, but the slave SQL thread would not stop and then may
assume the mapping is still available, the tables are still open...
So then we should clear mappings/rollback/close here only if this is a
- TRANS_END_F.
+ STMT_END_F.
For now we code, knowing that error is not skippable and so slave SQL
thread is certainly going to stop.
*/
ha_autocommit_or_rollback(thd, 1);
ha_rollback(thd);
- close_thread_tables(thd);
+ Table_map_log_event::cleanup(thd, rli);
thd->query_error= 1;
DBUG_RETURN(error);
}
- /*
- Some of this is copied from the Log_event::exec_event(). We step
- the relay log positions ourself, since the generic version does
- not behave the way we want.
- */
- if (get_flags(TRANS_END_F))
+ if (get_flags(STMT_END_F))
{
/*
This is the end of a statement or transaction, so close (and
@@ -5380,7 +5368,6 @@
(assume the last master's transaction is ignored by the slave because of
replicate-ignore rules).
*/
- rli->m_table_map.clear_tables();
thd->prepare_for_commit();
/*
@@ -5402,22 +5389,16 @@
pending event flushed.
*/
- close_thread_tables(thd); // unlocks and closes tables
+ Table_map_log_event::cleanup(thd, rli);
rli->transaction_end(thd);
if (error == 0)
- {
- rli->inc_group_relay_log_pos(log_pos);
- flush_relay_log_info(rli);
- rli->last_master_timestamp= when;
- }
+ error= Log_event::exec_event(rli);
else
- {
- slave_print_error(rli, error,
- "Error in %s event: commit of row events failed, "
- "table `%s`.`%s`",
- get_type_str(), table->s->db, table->s->table_name);
- }
+ slave_print_msg(ERROR_LEVEL, rli, error,
+ "Error in %s event: commit of row events failed, "
+ "table `%s`.`%s`",
+ get_type_str(), table->s->db, table->s->table_name);
DBUG_RETURN(error);
}
@@ -5487,7 +5468,7 @@
void Rows_log_event::pack_info(Protocol *protocol)
{
char buf[256];
- char const *const flagstr= get_flags(TRANS_END_F) ? "TRANS_END_F" : "";
+ char const *const flagstr= get_flags(STMT_END_F) ? "STMT_END_F" : "";
char const *const dbnam= m_table->s->db;
char const *const tblnam= m_table->s->table_name;
my_size_t bytes= snprintf(buf, sizeof(buf),
@@ -5709,11 +5690,11 @@
if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG)
&&
!binlog_row_based)
{
- slave_print_error(rli, ER_BINLOG_ROW_RBR_TO_SBR,
- "It is not possible to use statement-based binlogging "
- "on a slave that replicates row-based. Please use "
- "--binrow-format=row on slave if you want to use "
- "--log-slave-updates and read row-based binlog events.");
+ slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_RBR_TO_SBR,
+ "It is not possible to use statement-based binlogging "
+ "on a slave that replicates row-based. Please use "
+ "--binrow-format=row on slave if you want to use "
+ "--log-slave-updates and read row-based binlog events.");
DBUG_RETURN(ERR_RBR_TO_SBR);
}
@@ -5742,11 +5723,11 @@
simplifications (we don't honour --slave-skip-errors)
*/
uint actual_error= thd->net.last_errno;
- slave_print_error(rli,actual_error,
- "Error '%s' on opening table `%s`.`%s`",
- (actual_error ? thd->net.last_error :
- "unexpected success or fatal error"),
- table_list.db, table_list.table_name);
+ slave_print_msg(ERROR_LEVEL, rli, actual_error,
+ "Error '%s' on opening table `%s`.`%s`",
+ (actual_error ? thd->net.last_error :
+ "unexpected success or fatal error"),
+ table_list.db, table_list.table_name);
thd->query_error= 1;
}
DBUG_RETURN(error);
@@ -5810,20 +5791,20 @@
if (col == tsh->fields)
{
DBUG_ASSERT(tsh->db && tsh->table_name);
- slave_print_error(rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
- "Table width mismatch - "
- "received %u columns, %s.%s has %u columns",
- m_colcnt, tsh->db, tsh->table_name, tsh->fields);
+ slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
+ "Table width mismatch - "
+ "received %u columns, %s.%s has %u columns",
+ m_colcnt, tsh->db, tsh->table_name, tsh->fields);
}
else
{
DBUG_ASSERT(col < m_colcnt && col < tsh->fields);
DBUG_ASSERT(tsh->db && tsh->table_name);
- slave_print_error(rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
- "Column %d type mismatch - "
- "received type %d, %s.%s has type %d",
- col, m_coltype[col], tsh->db, tsh->table_name,
- m_table->field[col]->type());
+ slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
+ "Column %d type mismatch - "
+ "received type %d, %s.%s has type %d",
+ col, m_coltype[col], tsh->db, tsh->table_name,
+ m_table->field[col]->type());
}
thd->query_error= 1;
--- 1.141/sql/log_event.h 2005-11-30 15:33:19 +01:00
+++ 1.142/sql/log_event.h 2005-12-06 11:13:09 +01:00
@@ -1768,8 +1768,8 @@
enum enum_flag
{
- /* Last event of a transaction */
- TRANS_END_F = (1U << 0),
+ /* Last event of a statement */
+ STMT_END_F = (1U << 0),
/* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */
NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
--- 1.258/sql/slave.cc 2005-11-21 11:07:03 +01:00
+++ 1.259/sql/slave.cc 2005-12-06 11:13:09 +01:00
@@ -867,14 +867,16 @@
/*
- Writes an error message to rli->last_slave_error and rli->last_slave_errno
- (which will be displayed by SHOW SLAVE STATUS), and prints it to stderr.
+ Writes a message to stderr, and if it's an error message, to
+ rli->last_slave_error and rli->last_slave_errno (which will be displayed by
+ SHOW SLAVE STATUS).
SYNOPSIS
- slave_print_error()
- rli
+ slave_print_msg()
+ level The severity level
+ rli
err_code The error code
- msg The error message (usually related to the error code, but can
+ msg The message (usually related to the error code, but can
contain more information).
... (this is printf-like format, with % symbols in msg)
@@ -882,22 +884,42 @@
void
*/
-void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...)
+void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli,
+ int err_code, const char* msg, ...)
{
+ void (*report_function)(const char *, ...);
+ char buff[MAX_SLAVE_ERRMSG], *pbuff= buff;
+ uint pbuffsize= sizeof(buff);
va_list args;
va_start(args,msg);
- my_vsnprintf(rli->last_slave_error,
- sizeof(rli->last_slave_error), msg, args);
- rli->last_slave_errno = err_code;
- /* If the error string ends with '.', do not add a ',' it would be ugly */
- if (rli->last_slave_error[0] &&
- (*(strend(rli->last_slave_error)-1) == '.'))
- sql_print_error("Slave: %s Error_code: %d", rli->last_slave_error,
- err_code);
+ switch (level)
+ {
+ case ERROR_LEVEL:
+ /*
+ It's an error, it must be reported in Last_error and Last_errno in SHOW
+ SLAVE STATUS.
+ */
+ pbuff= rli->last_slave_error;
+ pbuffsize= sizeof(rli->last_slave_error);
+ rli->last_slave_errno = err_code;
+ report_function= sql_print_error;
+ break;
+ case WARNING_LEVEL:
+ report_function= sql_print_warning;
+ break;
+ case INFORMATION_LEVEL:
+ report_function= sql_print_information;
+ break;
+ default:
+ DBUG_ASSERT(0); // should not come here
+ return; // don't crash production builds, just do nothing
+ }
+ my_vsnprintf(pbuff, pbuffsize, msg, args);
+ /* If the msg string ends with '.', do not add a ',' it would be ugly */
+ if (pbuff[0] && (*(strend(pbuff)-1) == '.'))
+ (*report_function)("Slave: %s Error_code: %d", pbuff, err_code);
else
- sql_print_error("Slave: %s, Error_code: %d", rli->last_slave_error,
- err_code);
-
+ (*report_function)("Slave: %s, Error_code: %d", pbuff, err_code);
}
/*
@@ -3019,7 +3041,7 @@
else
{
pthread_mutex_unlock(&rli->data_lock);
- slave_print_error(rli, 0, "\
+ slave_print_msg(ERROR_LEVEL, rli, 0, "\
Could not parse relay log event entry. The possible reasons are: the master's \
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log), the slave's relay log is corrupted (you can check this by running \
--- 1.223/sql/sql_class.cc 2005-11-30 15:33:19 +01:00
+++ 1.224/sql/sql_class.cc 2005-12-06 11:13:09 +01:00
@@ -2432,19 +2432,19 @@
}
-int THD::binlog_flush_pending_rows_event(bool trans_end)
+int THD::binlog_flush_pending_rows_event(bool stmt_end)
{
if (!binlog_row_based || !mysql_bin_log.is_open())
return 0;
/*
- Mark the event as the last event of a transaction if the trans_end
+ Mark the event as the last event of a statement if the stmt_end
flag is set.
*/
Rows_log_event* pending;
- if (trans_end && (pending= binlog_get_pending_rows_event()))
+ if (stmt_end && (pending= binlog_get_pending_rows_event()))
{
- pending->set_flags(Rows_log_event::TRANS_END_F);
+ pending->set_flags(Rows_log_event::STMT_END_F);
pending->flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F;
}
--- 1.271/sql/sql_class.h 2005-11-30 15:33:19 +01:00
+++ 1.272/sql/sql_class.h 2005-12-06 11:13:10 +01:00
@@ -1291,7 +1291,7 @@
my_size_t pack_row(TABLE* table, MY_BITMAP const* cols, byte *row_data,
my_size_t max_len, const byte *data) const;
- int binlog_flush_pending_rows_event(bool transaction_end);
+ int binlog_flush_pending_rows_event(bool stmt_end);
void binlog_delete_pending_rows_event();
#endif
--- 1.19/mysql-test/r/rpl_stm_relayrotate.result 2005-08-13 11:00:51 +02:00
+++ 1.21/mysql-test/r/rpl_relayrotate.result 2005-12-06 11:13:10 +01:00
@@ -16,7 +16,4 @@
select max(a) from t1;
max(a)
8000
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735190 # # master-bin.000001 Yes Yes # 0 0 735190 # None 0 No #
drop table t1;
--- 1.20/mysql-test/extra/rpl_tests/rpl_stm_relayrotate.test 2005-10-20 20:56:24 +02:00
+++ 1.22/mysql-test/extra/rpl_tests/rpl_relayrotate.test 2005-12-06 11:13:10 +01:00
@@ -1,4 +1,3 @@
--- source include/have_binlog_format_statement.inc
# When the relay log gets rotated while the I/O thread
# is reading a transaction, the transaction spans on two or more
# relay logs. If STOP SLAVE occurs while the SQL thread is
@@ -57,9 +56,6 @@
# (the only statement with position>=3000 is COMMIT).
select master_pos_wait('master-bin.001',3000)>=0;
select max(a) from t1;
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
---replace_result $MASTER_MYPORT MASTER_MYPORT
-show slave status;
connection master;
# The following DROP is a very important cleaning task:
--- 1.12/wl1012-review-pending-comments.txt 2005-10-03 14:07:22 +02:00
+++ 1.13/wl1012-review-pending-comments.txt 2005-12-06 11:13:10 +01:00
@@ -1356,6 +1356,8 @@
[G] should rollback in the way Format_description_log_event::exec_event() does.
+[G2DONE] I did it
+
[G] clear_tables() should be called by
[G] Format_description_log_event::exec_event() too, in case the master
[G] crashed before writing a commit (and then master rolled back, so slave
@@ -1364,7 +1366,7 @@
[M] OK.
-[G2TODO]
+[G2DONE] I did it.
> + close_thread_tables(thd);
> + thd->query_error= 1;
@@ -1409,7 +1411,7 @@
[M] OK.
-[G2TODO]
+[G2DONE] I did it.
> + close_thread_tables(thd);
> + rli->transaction_end(thd);
--- 1.4/mysql-test/t/rpl_row_relayrotate.test 2005-10-20 21:22:07 +02:00
+++ 1.5/BitKeeper/deleted/.del-rpl_row_relayrotate.test~c411ee17c14c9ced 2005-12-03
15:41:14 +01:00
@@ -1,7 +1,7 @@
-#############################################################################
-# Includes
+########################################
+# Wrapper for rpl_relayrotate.test #
+########################################
-- source include/have_binlog_format_row.inc
-- source include/have_innodb.inc
let $engine_type=innodb;
--- source extra/rpl_tests/rpl_row_relayrotate.test
-
+-- source extra/rpl_tests/rpl_relayrotate.test
--- 1.4/mysql-test/t/rpl_stm_relayrotate.test 2005-10-20 20:57:15 +02:00
+++ 1.6/mysql-test/t/rpl_relayrotate.test 2005-12-06 11:13:10 +01:00
@@ -1,6 +1,3 @@
-########################################
-# Wrapper for rpl_stm_relayrotate.test #
-########################################
-#-- source include/have_innodb.inc
+-- source include/have_innodb.inc
let $engine_type=innodb;
--- source extra/rpl_tests/rpl_stm_relayrotate.test
+-- source extra/rpl_tests/rpl_relayrotate.test
--- 1.15/mysql-test/t/disabled.def 2005-11-30 08:21:34 +01:00
+++ 1.16/mysql-test/t/disabled.def 2005-12-06 11:13:09 +01:00
@@ -11,12 +11,10 @@
##############################################################################
sp-goto : GOTO is currently is disabled - will be fixed in the future
-rpl_relayrotate : Unstable test case, bug#12429
rpl_until : Unstable test case, bug#12429
rpl_deadlock : Unstable test case, bug#12429
kill : Unstable test case, bug#9712
rpl_row_mystery22:shows rbr slave issues Bug 12418
-rpl_row_relayrotate:Bug 14082
rpl_row_000002:create table from temporary Bug 12345
rpl_row_sp006_InnoDB:Bug 12586
rpl_row_view01:Bug 12687
--- 1.1/mysql-test/r/rpl_row_create_table.result 2005-12-01 12:27:57 +01:00
+++ 1.2/mysql-test/r/rpl_row_create_table.result 2005-12-06 11:13:09 +01:00
@@ -5,9 +5,9 @@
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT, b INT) ENGINE=BDB;
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
-CREATE TABLE t4 (a INT, b INT) ENGINE=BDB CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
SHOW BINLOG EVENTS FROM 206;
Log_name #
Pos 206
@@ -20,19 +20,19 @@
Event_type Query
Server_id #
End_log_pos #
-Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=BDB
+Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge
Log_name #
-Pos 403
+Pos 405
Event_type Query
Server_id #
End_log_pos #
Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8
Log_name #
-Pos 509
+Pos 511
Event_type Query
Server_id #
End_log_pos #
-Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=BDB CHARSET=utf8
+Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8
**** On Master ****
SHOW CREATE TABLE t1;
Table t1
@@ -45,7 +45,7 @@
Create Table CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
SHOW CREATE TABLE t3;
Table t3
Create Table CREATE TABLE `t3` (
@@ -64,7 +64,7 @@
Create Table CREATE TABLE `t2` (
`a` int(11) default NULL,
`b` int(11) default NULL
-) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()
SHOW CREATE TABLE t3;
Table t3
Create Table CREATE TABLE `t3` (
@@ -127,7 +127,7 @@
NULL 6 12
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 1
-SHOW BINLOG EVENTS FROM 1242;
+SHOW BINLOG EVENTS FROM 1246;
Log_name Pos Event_type Server_id End_log_pos Info
CREATE TABLE t7 (a INT, b INT UNIQUE);
INSERT INTO t7 SELECT a,b FROM tt3;
@@ -137,11 +137,11 @@
1 2
2 4
3 6
-SHOW BINLOG EVENTS FROM 1242;
+SHOW BINLOG EVENTS FROM 1246;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1242 Query 1 1342 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
-master-bin.000001 1342 Table_map 1 1380 test.t7
-master-bin.000001 1380 Write_rows 1 1434
+master-bin.000001 1246 Query 1 1346 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE)
+master-bin.000001 1346 Table_map 1 1384 test.t7
+master-bin.000001 1384 Write_rows 1 1438
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
@@ -154,10 +154,10 @@
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SHOW BINLOG EVENTS FROM 1434;
+SHOW BINLOG EVENTS FROM 1438;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 1434 Table_map 1 1472 test.t7
-master-bin.000001 1472 Write_rows 1 1526
+master-bin.000001 1438 Table_map 1 1476 test.t7
+master-bin.000001 1476 Write_rows 1 1530
SELECT * FROM t7 ORDER BY a,b;
a b
1 2
--- 1.1/mysql-test/t/rpl_row_create_table.test 2005-12-01 12:27:57 +01:00
+++ 1.2/mysql-test/t/rpl_row_create_table.test 2005-12-06 11:13:09 +01:00
@@ -22,9 +22,9 @@
connection master;
CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT, b INT) ENGINE=BDB;
+CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
-CREATE TABLE t4 (a INT, b INT) ENGINE=BDB CHARSET=utf8;
+CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8;
--replace_column 1 # 4 # 5 #
--query_vertical SHOW BINLOG EVENTS FROM 206
--echo **** On Master ****
@@ -60,7 +60,7 @@
--error 1062
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log
-SHOW BINLOG EVENTS FROM 1242;
+SHOW BINLOG EVENTS FROM 1246;
# Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE);
@@ -68,7 +68,7 @@
INSERT INTO t7 SELECT a,b FROM tt3;
SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log
-SHOW BINLOG EVENTS FROM 1242;
+SHOW BINLOG EVENTS FROM 1246;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
@@ -78,7 +78,7 @@
BEGIN;
INSERT INTO t7 SELECT a,b FROM tt4;
ROLLBACK;
-SHOW BINLOG EVENTS FROM 1434;
+SHOW BINLOG EVENTS FROM 1438;
SELECT * FROM t7 ORDER BY a,b;
sync_slave_with_master;
SELECT * FROM t7 ORDER BY a,b;
--- 1.5/mysql-test/extra/rpl_tests/rpl_row_relayrotate.test 2005-10-20 21:20:03 +02:00
+++ 1.6/BitKeeper/deleted/.del-rpl_row_relayrotate.test~c42d04bb4781bd54 2005-12-03
15:35:25 +01:00
@@ -51,6 +51,7 @@
# If so the transaction was rolled back
# and the table is now empty.
# Now restart
+show slave status;
start slave;
# And see if the table contains '8000'
# which proves that the transaction restarted at
@@ -58,7 +59,7 @@
# We must wait for the transaction to commit before
# reading, MASTER_POS_WAIT() will do it for sure
# (the only statement with position>=3000 is COMMIT).
-select master_pos_wait('master-bin.001',552270)>=0;
+select master_pos_wait('master-bin.001',3000)>=0;
select max(a) from t1;
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
--- 1.93/sql/slave.h 2005-11-19 16:33:23 +01:00
+++ 1.94/sql/slave.h 2005-12-06 11:13:09 +01:00
@@ -554,7 +554,8 @@
const char *print_slave_db_safe(const char *db);
int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code);
void skip_load_data_infile(NET* net);
-void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...);
+void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli,
+ int err_code, const char* msg, ...);
void end_slave(); /* clean up */
void init_master_info_with_options(MASTER_INFO* mi);
| Thread |
|---|
| • bk commit into 5.1 tree (guilhem:1.1980) BUG#14082 | guilhem | 6 Dec |