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

@ -1427,10 +1427,15 @@ public:
size_t needed,
bool is_transactional,
RowsEventT* hint);
Rows_log_event* binlog_get_pending_rows_event() const;
void binlog_set_pending_rows_event(Rows_log_event* ev);
int binlog_flush_pending_rows_event(bool stmt_end);
int binlog_remove_pending_rows_event(bool clear_maps);
Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const;
void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional);
inline int binlog_flush_pending_rows_event(bool stmt_end)
{
return (binlog_flush_pending_rows_event(stmt_end, FALSE) ||
binlog_flush_pending_rows_event(stmt_end, TRUE));
}
int binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional);
int binlog_remove_pending_rows_event(bool clear_maps, bool is_transactional);
/**
Determine the binlog format of the current statement.
@ -1494,6 +1499,9 @@ public:
uint get_binlog_table_maps() const {
return binlog_table_maps;
}
void clear_binlog_table_maps() {
binlog_table_maps= 0;
}
#endif /* MYSQL_CLIENT */
public:
@ -1959,8 +1967,8 @@ public:
};
int binlog_query(enum_binlog_query_type qtype,
char const *query, ulong query_len,
bool is_trans, bool suppress_use,
char const *query, ulong query_len, bool is_trans,
bool direct, bool suppress_use,
int errcode);
#endif
@ -2009,6 +2017,21 @@ public:
return 0;
#endif
}
/**
Returns TRUE if session is in a multi-statement transaction mode.
OPTION_NOT_AUTOCOMMIT: When autocommit is off, a multi-statement
transaction is implicitly started on the first statement after a
previous transaction has been ended.
OPTION_BEGIN: Regardless of the autocommit status, a multi-statement
transaction can be explicitly started with the statements "START
TRANSACTION", "BEGIN [WORK]", "[COMMIT | ROLLBACK] AND CHAIN", etc.
*/
inline bool in_multi_stmt_transaction()
{
return options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN);
}
inline bool fill_derived_tables()
{
return !stmt_arena->is_stmt_prepare() && !lex->only_view_structure();