Chuck, hi.
> Below is the list of changes that have just been committed into a local
> 5.0 repository of cbell. When cbell 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-08-30 15:34:50-04:00, cbell@mysql_cab_desk. +1 -0
> BUG#26395 : if crash during autocommit update to transactional table on master,
> slave fails
>
Maybe we need to get in sync with the synopsis as upon reading
discussion's lines I found out that the main problem is in
consistency.
Also, please state that as in problem description paragraph (where
is it?).
> This patch ensures that a BEGIN statement is written every time the method
> MYSQL_LOG::write() there is called with a transactional engine present.
>
That's logical.
> sql/log.cc@stripped, 2007-08-30 15:34:48-04:00, cbell@mysql_cab_desk. +6 -2
> BUG#26395 : if crash during autocommit update to transactional table on master,
> slave fails
>
> This patch adds a condition to the code to write the "BEGIN"
> statement every time the method MYSQL_LOG::write(THD *thd,
> IO_CACHE *cache, Log_event *commit_event) is called with a
> transactional engine present.
>
> diff -Nrup a/sql/log.cc b/sql/log.cc
> --- a/sql/log.cc 2007-07-30 11:27:30 -04:00
> +++ b/sql/log.cc 2007-08-30 15:34:48 -04:00
> @@ -1842,8 +1842,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE
> /*
> Log "BEGIN" at the beginning of the transaction.
> which may contain more than 1 SQL statement.
> +
> + We also need to write the "BEGIN" if we are using transactional
> + engines (nht == 1 whenever binlog_start_trans_and_stmt() is called)
> + indicated by nht > 1 in the st_thd_trans (THD_TRANS) structure.
> */
> - if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
> + if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
> + (thd->transaction.stmt.nht > 1))
> {
> Query_log_event qinfo(thd, STRING_WITH_LEN("BEGIN"), TRUE, FALSE);
> /*
That's okay. Although currently the method is invoked
like
mysql_bin_log.write(thd, trans_log, end_ev)
ie caller already has checked presense of transactional tables.
> @@ -1871,7 +1876,6 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE
> goto err;
>
> length= my_b_bytes_in_cache(cache);
> - DBUG_EXECUTE_IF("half_binlogged_transaction", length-=100;);
>
As i understand, you don't like the slave to stop in the middle of
reading partially written event. I am okay with that but still why?
Were you going to show that slave indeed applied the query and went
out of sync? If so, where is the test?
> /*
> The events in the buffer have incorrect end_log_pos data
>
>
regards,
Andrei