1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

BUG#29020 (Event results not correctly replicated to slave in RBR):

The bug allow multiple executing transactions working with non-transactional
to interfere with each others by interleaving the events of different trans-
actions.

Bug is fixed by writing non-transactional events to the transaction cache and
flushing the cache to the binary log at statement commit. To mimic the behavior
of normal statement-based replication, we flush the transaction cache in row-
based mode when there is no committed statements in the transaction cache,
which means we are committing the first one. This means that it will be written
to the binary log as a "mini-transaction" with just the rows for the statement.

Note that the changes here does not take effect when building the server with
HAVE_TRANSACTIONS set to false, but it is not clear if this was possible before
this patch either.

For row-based logging, we also have that when AUTOCOMMIT=1, the code now always
generates a BEGIN/COMMIT pair for single statements, or BEGIN/ROLLBACK pair in the
case of non-transactional changes in a statement that was rolled back. Note that
for the case where changes to a non-transactional table causes a rollback due
to error, the statement will now be logged with a BEGIN/ROLLBACK pair, even
though some changes has been committed to the non-transactional table.
This commit is contained in:
mats@mats-laptop.(none)
2008-03-28 13:16:41 +01:00
parent 51ad2901d4
commit c8c4500a98
33 changed files with 473 additions and 534 deletions

View File

@@ -2426,6 +2426,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
*/
di->table->file->ha_release_auto_increment();
mysql_unlock_tables(thd, lock);
ha_autocommit_or_rollback(thd, 0);
di->group_count=0;
pthread_mutex_lock(&di->mutex);
}
@@ -3676,14 +3677,11 @@ void select_create::abort()
{
DBUG_ENTER("select_create::abort");
/*
Disable binlog, because we "roll back" partial inserts in ::abort
by removing the table, even for non-transactional tables.
*/
tmp_disable_binlog(thd);
/*
In select_insert::abort() we roll back the statement, including
truncating the transaction cache of the binary log.
truncating the transaction cache of the binary log. To do this, we
pretend that the statement is transactional, even though it might
be the case that it was not.
We roll back the statement prior to deleting the table and prior
to releasing the lock on the table, since there might be potential
@@ -3694,7 +3692,9 @@ void select_create::abort()
of the table succeeded or not, since we need to reset the binary
log state.
*/
tmp_disable_binlog(thd);
select_insert::abort();
thd->transaction.stmt.modified_non_trans_table= FALSE;
reenable_binlog(thd);