• Guangbao Ni's avatar
    BUG#41980 SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 ! · 4f0f021c
    Guangbao Ni authored
          
    When binlog_format is STATEMENT and the statement is unsafe before,
    the unsafe warning/error message was issued without checking
    whether the SQL_LOG_BIN was turned on or not.
          
    Fixed with adding a sql_log_bin_toplevel flag in THD to check
    whether SQL_LOG_BIN is ON in current session whatever the current is in sp or not.
    
    
    mysql-test/suite/binlog/r/binlog_unsafe.result:
      Test case result for unsafe warning/error message
    mysql-test/suite/binlog/t/binlog_unsafe.test:
      Test case for unsafe message warning/error
    sql/set_var.cc:
      Adding a function set_option_log_bin_bit() which specailly handles to
      the change of SQL_LOG_BIN bit in order to set sql_log_bin_toplevel
      according to SQL_LOG_BIN current value at the same time.
    sql/sql_class.cc:
      Initialize the flag sql_log_bin_toplevel in THD::init(),
      and add the condition to check whether unsafe ror message was issued.
    sql/sql_class.h:
      Add a sql_log_bin_toplevel flag in THD to indicate whether the toplevel SQL_LOG_BIN is
    4f0f021c
binlog_unsafe.test 10.6 KB