Hi Zhenxing,
Thanks for you review.
On Mon, 2010-09-06 at 15:26 +0800, He Zhenxing wrote:
> Hi Libing,
>
> >
> > Added test for bug#39804.
> > @ mysql-test/suite/rpl/t/rpl_create_table.test
> > Rename this file. Now not only 'CREATE TABLE IF NOT EXISTS' but also
> > all other 'CREATE TABLE' statemens' tests can be put in this file.
> >
>
> statements
ok.
>
> > Added test for bug#39804.
> > @ sql/binlog.cc
> > Trx-cache is always able to be truncated when a SINGLE statement
> transaction
> > rolls back and is on RBR.
> > @ sql/sql_class.h
> > Add modified_other_non_trans_table into select_create class.
> > @ sql/sql_insert.cc
> > Binlog the CTS statement if other non-trasactional tables is modified.
> >
>
> transactional
ok.
>
> > tmp_disable_binlog() appeared to be redundant in the context of
> > create_select::abort_result_set(). It's correct to calculate value of
> > thd->transaction.stmt.modified_non_trans_table before
> > create_select::abort_result_set() that logs in STMT format a way
> > dependent on `modified_non_trans_table'.
> > The calculated value continues to control logging in ROW format same
> way
> > as it was in the base code before the patch.
> >
[snip]
> > +
> > + --echo
> > + --echo # Create a $_engine table and another transactional table(t3) is
> updated.
> > + --error ER_DUP_ENTRY
> > + eval CREATE $_temp_option TABLE t1(UNIQUE(a)) ENGINE=$_engine
> > + SELECT 1 AS a UNION ALL SELECT f_insert_t3 ();
> > + --echo # Nothing should be binlogged
> > + source include/show_binlog_events.inc;
> > +
> > + --echo
> > + --echo # Create a $_engine table and both of the transaction table(t3) and
> > + --echo # non-transaction table(t2) are updated.
> > +
> > + --error ER_DUP_ENTRY
> > + eval CREATE $_temp_option TABLE t1(UNIQUE(a)) ENGINE=$_engine
> > + SELECT f_insert_t3() AS a UNION ALL SELECT f_insert_t2 ();
> > + if ($_is_RBR)
> > + {
> > + # There should be only 4 events binlogged and 'CREATE TABLE' should not
> be
> > + # binlogged
> > + # BEGIN
> > + # Table_map
> > + # Row event
> > + # COMMIT
> > +
> > + let $event= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM
> $binlog_start, Info, 5);
> > + if (`SELECT '$event' <> 'No such row'`)
> > + {
> > + show binlog events;
> > + --echo Unexpected event is binlogged: '$event'.
> > + --die Unexpected event is binlogged.
> > + }
>
> I'd suggest to also check that the first 4 events are actually BEGIN,
> Table_map, Row_event and COMMIT.
+ source include/rpl_diff_tables.inc;
check if row events of other tables are replicated correctly.
If those events are failed to be binlogged, rpl_diff_tables will abort
the test.
>
> > + }
> > +
> > + if (!_is_RBR)
> > + {
> > + # The CREATE TABLE ... SELECT should be binlogged.
> > + let $event= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM
> $binlog_start, Info, 1);
> > + if (`SELECT '$event' == 'No such row'`)
> > + {
> > + --echo Expected event(CREATE TABLE ... SELECT) is not binlogged.
> > + --die Expected event(CREATE TABLE ... SELECT) is not binlogged.
> > + }
> > + }
> > + let $diff_table=test.t2;
> > + source include/rpl_diff_tables.inc;
> > + let $diff_table=test.t3;
> > + source include/rpl_diff_tables.inc;
> > +
> > +
[snip]
> >
> > === modified file 'sql/sql_parse.cc'
> > --- a/sql/sql_parse.cc 2010-08-20 09:15:16 +0000
> > +++ b/sql/sql_parse.cc 2010-09-03 04:10:22 +0000
> > @@ -2537,10 +2537,6 @@ case SQLCOM_PREPARE:
> > */
> > lex->unlink_first_table(&link_to_local);
> >
> > - /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
> > - if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
> > - thd->variables.option_bits|= OPTION_KEEP_LOG;
> > -
>
> There is another place that also set OPTION_KEEP_LOG for CREATE
> TEMPORARY TABLE without SELECT, which I think should also be removed.
Yes, it should be removed.
>
> > /*
> > select_create is currently not re-execution friendly and
> > needs to be created for every execution of a PS/SP.
> > @@ -2585,6 +2581,11 @@ case SQLCOM_PREPARE:
> > if (!res)
> > my_ok(thd);
> > }
> > + /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
> > + if (!res && (create_info.options & HA_LEX_CREATE_TMP_TABLE)
> &&
> > + thd->in_multi_stmt_transaction_mode() &&
> > + !thd->is_current_stmt_binlog_format_row())
> > + thd->variables.option_bits|= OPTION_KEEP_LOG;
> >
> > end_with_restore_list:
> > break;
>
>
--
Your Sincerely,
Libing Song
==================================
MySQL Replication Team
Software Engineer
Email : Li-Bing.Song@stripped
Skype : libing.song
MSN : slb_database@stripped
Phone : +86 010-6505-4020 ext. 319
Mobile: +86 138-1144-2038
==================================