summaryrefslogtreecommitdiff
path: root/sql/log.h
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2006-02-25 22:21:03 +0100
committerguilhem@mysql.com <>2006-02-25 22:21:03 +0100
commit0071749595d83885261278f6a488b019acd63913 (patch)
treed3a16d5f3b8f1c0bd0941caf3ae057efca391ea7 /sql/log.h
parent3de74e62370eb8fed4810c283fa526befb04920f (diff)
downloadmariadb-git-0071749595d83885261278f6a488b019acd63913.tar.gz
WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement),
and new binlog format called "mixed" (which is statement-based except if only row-based is correct, in this cset it means if UDF or UUID is used; more cases could be added in later 5.1 release): SET GLOBAL|SESSION BINLOG_FORMAT=row|statement|mixed|default; the global default is statement unless cluster is enabled (then it's row) as in 5.1-alpha. It's not possible to use SET on this variable if a session is currently in row-based mode and has open temporary tables (because CREATE TEMPORARY TABLE was not binlogged so temp table is not known on slave), or if NDB is enabled (because NDB does not support such change on-the-fly, though it will later), of if in a stored function (see below). The added tests test the possibility or impossibility to SET, their effects, and the mixed mode, including in prepared statements and in stored procedures and functions. Caveats: a) The mixed mode will not work for stored functions: in mixed mode, a stored function will always be binlogged as one call and in a statement-based way (e.g. INSERT VALUES(myfunc()) or SELECT myfunc()). b) for the same reason, changing the thread's binlog format inside a stored function is refused with an error message. c) the same problems apply to triggers; implementing b) for triggers will be done later (will ask Dmitri). Additionally, as the binlog format is now changeable by each user for his session, I remove the implication which was done at startup, where row-based automatically set log-bin-trust-routine-creators to 1 (not possible anymore as a user can now switch to stmt-based and do nasty things again), and automatically set --innodb-locks-unsafe-for-binlog to 1 (was anyway theoretically incorrect as it disabled phantom protection). Plus fixes for compiler warnings.
Diffstat (limited to 'sql/log.h')
-rw-r--r--sql/log.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/log.h b/sql/log.h
index 98a86072fca..8a83e7b66d0 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -507,4 +507,24 @@ public:
void init_general_log(uint general_log_printer);
};
+
+enum enum_binlog_format {
+ BINLOG_FORMAT_STMT= 0, // statement-based
+#ifdef HAVE_ROW_BASED_REPLICATION
+ BINLOG_FORMAT_ROW= 1, // row_based
+ /*
+ statement-based except for cases where only row-based can work (UUID()
+ etc):
+ */
+ BINLOG_FORMAT_MIXED= 2,
+#endif
+/*
+ This value is last, after the end of binlog_format_typelib: it has no
+ corresponding cell in this typelib. We use this value to be able to know if
+ the user has explicitely specified a binlog format at startup or not.
+*/
+ BINLOG_FORMAT_UNSPEC= 3
+};
+extern TYPELIB binlog_format_typelib;
+
#endif /* LOG_H */