mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem". The idea of the fix is to ensure that we always commit the current statement at the end of dispatch_command(). In order to not issue redundant disc syncs, an optimization of the two-phase commit protocol is implemented to bypass the two phase commit if the transaction is read-only.
This commit is contained in:
10
sql/log.cc
10
sql/log.cc
@ -3332,6 +3332,16 @@ THD::binlog_start_trans_and_stmt()
|
||||
if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
trans_register_ha(this, TRUE, binlog_hton);
|
||||
trans_register_ha(this, FALSE, binlog_hton);
|
||||
/*
|
||||
Mark statement transaction as read/write. We never start
|
||||
a binary log transaction and keep it read-only,
|
||||
therefore it's best to mark the transaction read/write just
|
||||
at the same time we start it.
|
||||
Not necessary to mark the normal transaction read/write
|
||||
since the statement-level flag will be propagated automatically
|
||||
inside ha_commit_trans.
|
||||
*/
|
||||
ha_data[binlog_hton->slot].ha_info[0].set_trx_read_write();
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
Reference in New Issue
Block a user