summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-12-11 15:46:39 +0200
committerunknown <monty@mashka.mysql.fi>2002-12-11 15:46:39 +0200
commit934f5cc4662ded62609ce64be15c54d327cc554e (patch)
tree39c72cd72a11f307f9898185deca1854ccf90c57 /sql/log_event.cc
parent3c9b877b19bd4eaa4734ea5d699add9ca70a4e53 (diff)
downloadmariadb-git-934f5cc4662ded62609ce64be15c54d327cc554e.tar.gz
Ensure that BEGIN / COMMIT is handled properly if slave dies
Added syntax support for CREATE TABLE foo (a char CHARACTER SET latin1) CHARSET=latin1; Docs/internals.texi: Update binary protocol description innobase/include/db0err.h: Merge from 3.23 mysql-test/r/insert.result: Updated test result from 3.23 sql/log.cc: Fixed bug in replication and log rotation sql/log_event.cc: Ensure that BEGIN / COMMIT is handled properly if slave dies sql/slave.cc: Fixed bug in replication and log rotation sql/slave.h: Ensure that BEGIN / COMMIT is handled properly if slave dies sql/sql_analyse.cc: Moved usage of res before res is destroyed (by bzero(&s...)) sql/sql_yacc.yy: Added syntax support for CREATE TABLE foo (a char CHARACTER SET latin1) CHARSET=latin1; To be able to read MySQL 4.1 dump files.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 373e50b84f7..d451a5bc46c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -208,9 +208,13 @@ int Log_event::exec_event(struct st_relay_log_info* rli)
{
if (rli) // QQ When is this not true ?
{
- rli->inc_pos(get_event_len(),log_pos);
- DBUG_ASSERT(rli->sql_thd != 0);
- flush_relay_log_info(rli);
+ if (rli->inside_transaction)
+ rli->inc_pending(get_event_len());
+ else
+ {
+ rli->inc_pos(get_event_len(),log_pos);
+ flush_relay_log_info(rli);
+ }
}
return 0;
}
@@ -1707,6 +1711,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd, thd->query, q_len);
+
+ /*
+ Set a flag if we are inside an transaction so that we can restart
+ the transaction from the start if we are killed
+
+ This will only be done if we are supporting transactional tables
+ in the slave.
+ */
+ if (!strcmp(thd->query,"BEGIN"))
+ rli->inside_transaction= opt_using_transactions;
+ else if (!strcmp(thd->query,"COMMIT"))
+ rli->inside_transaction=0;
+
if ((expected_error != (actual_error = thd->net.last_errno)) &&
expected_error &&
!ignored_error_code(actual_error) &&