• Davi Arnaut's avatar
    Bug#46265: Can not disable warning about unsafe statements for binary logging · 7d8b967a
    Davi Arnaut authored
    If using statement based replication (SBR), repeatedly calling
    statements which are unsafe for SBR will cause a warning message
    to be written to the error for each statement. This might lead
    to filling up the error log and there is no way to disable this
    behavior.
    
    The solution is to only log these message (about statements unsafe
    for statement based replication) if the log_warnings option is set.
    
    For example:
    
    SET GLOBAL LOG_WARNINGS = 0;
    INSERT INTO t1 VALUES(UUID());
    SET GLOBAL LOG_WARNINGS = 1;
    INSERT INTO t1 VALUES(UUID());
    
    In this case the message will be printed only once:
    
    [Warning] Statement may not be safe to log in statement format.
              Statement: INSERT INTO t1 VALUES(UUID())
    
    mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result:
      Add test case result for Bug#46265
    mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt:
      Make log_error value available.
    mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test:
      Add test case for Bug#46265
    sql/sql_class.cc:
      Print warning only if the log_warnings is enabled.
    7d8b967a
binlog_stm_unsafe_warning-master.opt 38 Bytes