Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats 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.1823 05/04/26 09:05:09 mats@stripped +6 -0
WL#2324: Injector now using parser functions for transaction handling.
sql/sql_parse.cc
1.425 05/04/26 09:05:04 mats@stripped +1 -1
Exporting begin_trans() from sql_parse.cc.
sql/sql_class.cc
1.181 05/04/26 09:05:04 mats@stripped +7 -4
Table map events were not written at the correct times.
sql/rpl_injector.cc
1.13 05/04/26 09:05:04 mats@stripped +8 -13
Using parsers begin_trans() and end_trans() to perform transaction handling.
sql/mysql_priv.h
1.291 05/04/26 09:05:04 mats@stripped +1 -0
Exporting begin_trans() from sql_parse.cc.
sql/log_event.cc
1.181 05/04/26 09:05:04 mats@stripped +1 -1
Using the filter classes.
mysql-test/r/rpl_row_basic_3innodb.result
1.2 05/04/26 09:05:04 mats@stripped +9 -0
New COMMIT events in the binary log.
# 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: mats
# Host: romeo.kindahl.net
# Root: /home/bk/w2325-mysql-5.1
--- 1.180/sql/log_event.cc 2005-04-22 20:56:06 +02:00
+++ 1.181/sql/log_event.cc 2005-04-26 09:05:04 +02:00
@@ -5361,7 +5361,7 @@
int error = 0;
- if (!table_rules_on || tables_ok(thd, &table_list))
+ if (!rpl_filter->is_on() || rpl_filter->tables_ok("", &table_list))
{
/*
Open the table if it is not already open and add the table to table map.
--- 1.290/sql/mysql_priv.h 2005-04-14 14:19:43 +02:00
+++ 1.291/sql/mysql_priv.h 2005-04-26 09:05:04 +02:00
@@ -487,6 +487,7 @@
COMMIT_RELEASE=-1, COMMIT=0, COMMIT_AND_CHAIN=6
};
+int begin_trans(THD *thd);
int end_trans(THD *thd, enum enum_mysql_completiontype completion);
Item *negate_expression(THD *thd, Item *expr);
--- 1.180/sql/sql_class.cc 2005-04-22 20:56:07 +02:00
+++ 1.181/sql/sql_class.cc 2005-04-26 09:05:04 +02:00
@@ -1906,11 +1906,9 @@
|| pending->get_cols() != cols
|| !mysql_bin_log.is_table_mapped(table))
{
+ bool was_mapped = mysql_bin_log.is_table_mapped(table);
+
// If not, flush the event and create a new RowsEventT.
-
- // If the table does not exist, write a table map for the new table
- if (!mysql_bin_log.is_table_mapped(table))
- write_table_map(table,is_transactional);
ulong const tid = mysql_bin_log.get_table_id(table);
Rows_log_event* const
@@ -1920,6 +1918,11 @@
delete ev;
DBUG_RETURN(NULL);
}
+
+ // We are preparing for a new kind of row-level event, so we have to write
+ // a map for it, if the table was not previously mapped, of course.
+ if (!was_mapped)
+ write_table_map(table,is_transactional);
DBUG_RETURN(ev);
}
DBUG_RETURN(pending);
--- 1.424/sql/sql_parse.cc 2005-04-20 00:35:34 +02:00
+++ 1.425/sql/sql_parse.cc 2005-04-26 09:05:04 +02:00
@@ -145,7 +145,7 @@
DBUG_RETURN(error);
}
-static bool begin_trans(THD *thd)
+int begin_trans(THD *thd)
{
int error=0;
if (thd->locked_tables)
--- 1.12/sql/rpl_injector.cc 2005-04-19 15:31:01 +02:00
+++ 1.13/sql/rpl_injector.cc 2005-04-26 09:05:04 +02:00
@@ -11,24 +11,22 @@
transaction(MYSQL_LOG* log, THD* thd)
: m_thd(thd)
{
- // Default initialization of m_start_pos (which initializes it to garbage).
- // We need to fill it in using the code below.
-
+ /*
+ Default initialization of m_start_pos (which initializes it to garbage).
+ We need to fill it in using the code below.
+ */
LOG_INFO log_info;
log->get_current_log(&log_info);
// !!! binlog_pos does not follow RAII !!!
m_start_pos.m_file_name = my_strdup(log_info.log_file_name, MYF(0));
m_start_pos.m_file_pos = log_info.pos;
- m_thd->transaction_begin(); // !!! Can fail
+
+ begin_trans(m_thd);
}
injector::transaction::
~transaction()
{
- // To flush the pending event and clean up the pending stuff for the
- // transaction.
- m_thd->transaction_end(); // !!! Can fail
-
// Needed since my_free expects a 'char*' (instead of 'void*').
char* const the_memory = const_cast<char*>(m_start_pos.m_file_name);
@@ -44,8 +42,7 @@
commit()
{
DBUG_ENTER("injector::transaction::commit()");
- m_thd->transaction_end();
- ha_commit(m_thd);
+ end_trans(m_thd, COMMIT);
DBUG_RETURN(0);
}
@@ -124,9 +121,7 @@
{
DBUG_ENTER("injector::new_trans(THD*, transaction*)");
// Currently, there is no alternative to using 'mysql_bin_log' since that
- // is hardcoded into the way the handler is using the binary log. This
- // version uses placement new to construct the object at a specific memory
- // address.
+ // is hardcoded into the way the handler is using the binary log.
transaction trans(&mysql_bin_log, thd);
ptr->swap(trans);
--- 1.1/mysql-test/r/rpl_row_basic_3innodb.result 2005-04-18 03:45:24 +02:00
+++ 1.2/mysql-test/r/rpl_row_basic_3innodb.result 2005-04-26 09:05:04 +02:00
@@ -21,8 +21,10 @@
<binlog> <pos> Query 1 <end_log_pos> use `test`; CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB'
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=91 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=92 */
SELECT * FROM t1 ORDER BY C1,C2;
C1 C2
A A
@@ -46,10 +48,13 @@
<binlog> <pos> Query 1 <end_log_pos> use `test`; CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB'
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=91 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=92 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Delete_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=98 */
SELECT * FROM t1 ORDER BY C1,C2;
C1 C2
A B
@@ -69,12 +74,16 @@
<binlog> <pos> Query 1 <end_log_pos> use `test`; CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB'
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=91 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Write_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=92 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Delete_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=98 */
<binlog> <pos> Table_map 1 <end_log_pos>
<binlog> <pos> Update_rows 1 <end_log_pos>
+<binlog> <pos> Xid 1 <end_log_pos> COMMIT /* xid=104 */
SELECT * FROM t1 ORDER BY C1,C2;
C1 C2
A B
| Thread |
|---|
| • bk commit into 5.1 tree (mats:1.1823) | Mats Kindahl | 26 Apr |