1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

WL#2687 WL#5072 BUG#40278 BUG#47175

Non-transactional updates that take place inside a transaction present problems
for logging because they are visible to other clients before the transaction
is committed, and they are not rolled back even if the transaction is rolled
back. It is not always possible to log correctly in statement format when both
transactional and non-transactional tables are used in the same transaction.

In the current patch, we ensure that such scenario is completely safe under the
ROW and MIXED modes.
This commit is contained in:
Alfranio Correia
2009-11-03 19:02:56 +00:00
parent 97565b8d1a
commit 19c380aaff
149 changed files with 41957 additions and 3661 deletions

View File

@ -1730,7 +1730,7 @@ end:
*/
void write_bin_log(THD *thd, bool clear_error,
char const *query, ulong query_length)
char const *query, ulong query_length, bool is_trans)
{
if (mysql_bin_log.is_open())
{
@ -1739,8 +1739,9 @@ void write_bin_log(THD *thd, bool clear_error,
thd->clear_error();
else
errcode= query_error_code(thd, TRUE);
thd->binlog_query(THD::STMT_QUERY_TYPE,
query, query_length, FALSE, FALSE, errcode);
query, query_length, is_trans, FALSE, FALSE, errcode);
}
}
@ -2127,7 +2128,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
*/
built_tmp_query.chop(); // Chop of the last comma
built_tmp_query.append(" /* generated by server */");
write_bin_log(thd, !error, built_tmp_query.ptr(), built_tmp_query.length());
write_bin_log(thd, !error, built_tmp_query.ptr(), built_tmp_query.length(),
thd->in_multi_stmt_transaction());
}
}
@ -6525,7 +6527,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
0, FALSE, 0);
FALSE, TRUE, FALSE, 0);
mysql_bin_log.write(&qinfo);
}
my_ok(thd);