• guilhem@mysql.com's avatar
    WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement), · 00717495
    guilhem@mysql.com authored
    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.
    00717495
sql_delete.cc 28.4 KB