summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2009-11-03 19:02:56 +0000
committerAlfranio Correia <alfranio.correia@sun.com>2009-11-03 19:02:56 +0000
commit19c380aaff1f1f3c0d21ac0c18904c21d7bdce76 (patch)
tree0e262b0d25432c224e2d4c8e1a1d608f78444771 /sql/sql_class.h
parent97565b8d1ab24b6f861300c75a4f4f3c7d711be6 (diff)
downloadmariadb-git-19c380aaff1f1f3c0d21ac0c18904c21d7bdce76.tar.gz
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.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 521884f3f4d..b6950108be4 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -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();