summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
committerKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
commit9c030fe5081163babdc8ef24395d108a394107fe (patch)
tree16fe2efa0a3d5e40e00972a1dc3bc4e13f71170c /sql/sys_vars.cc
parent0b2f51664d38ed24f3f8b237877520e45bfe83f6 (diff)
parent19df110369d4cef5303176a8aedca34cd0e2d271 (diff)
downloadmariadb-git-9c030fe5081163babdc8ef24395d108a394107fe.tar.gz
Merge next-mr -> next-4284.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index e04b7be616f..73d01f5341d 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -300,6 +300,48 @@ static Sys_var_enum Sys_binlog_format(
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_format_check),
ON_UPDATE(fix_binlog_format_after_update));
+static bool binlog_direct_check(sys_var *self, THD *thd, set_var *var)
+{
+ /*
+ Makes the session variable 'binlog_direct_non_transactional_updates'
+ read-only inside a transaction.
+ */
+ if (thd->active_transaction() && (var->type == OPT_SESSION))
+ {
+ my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
+ return 1;
+ }
+ /*
+ Makes the session variable 'binlog_direct_non_transactional_updates'
+ read-only if within a procedure, trigger or function.
+ */
+ if (thd->in_sub_stmt)
+ {
+ my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
+ return 1;
+ }
+
+ if (check_has_super(self, thd, var))
+ return true;
+ if (var->type == OPT_GLOBAL ||
+ (thd->variables.binlog_direct_non_trans_update ==
+ var->save_result.ulonglong_value))
+ return false;
+
+ return false;
+}
+
+static Sys_var_mybool Sys_binlog_direct(
+ "binlog_direct_non_transactional_updates",
+ "Causes updates to non-transactional engines using statement format to "
+ "be written directly to binary log. Before using this option make sure "
+ "that there are no dependencies between transactional and "
+ "non-transactional tables such as in the statement INSERT INTO t_myisam "
+ "SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.",
+ SESSION_VAR(binlog_direct_non_trans_update),
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
+
static Sys_var_ulong Sys_bulk_insert_buff_size(
"bulk_insert_buffer_size", "Size of tree cache used in bulk "
"insert optimisation. Note that this is a limit per thread!",