• Alfranio Correia's avatar
    BUG#49019 Mixing self-logging eng. and regular eng. does not switch to row in mixed mode · 3fad4e8d
    Alfranio Correia authored
    Reading from a self-logging engine and updating a transactional engine such as Innodb
    generates changes that are written to the binary log in the statement format and may
    make slaves diverge. In the mixed mode, such changes should be written to the binary
    log in the row format.
    
    Note that the issue does not happen if we mix a self-logging engine and MyIsam
    as this case is caught by checking the mixture of non-transactional and transactional
    engines.
    
    So, we classify a mixed statement where one reads from NDB and writes into another 
    engine as unsafe:
    
    if (multi_engine && flags_some_set & HA_HAS_OWN_BINLOGGING)
      lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE);
    
    mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result:
      Augmented test case to check mixed statements
    mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test:
      Augmented test case to check mixed statements
    sql/share/errmsg-utf8.txt:
      Added ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
    sql/sql_class.cc:
      Redefined flags' name in order to have two sets of flags: (i) flags that are checked when there
      is a write operation; (ii) flags that are checked regardless of the type of the operation.
      
      Classified a mixed statement where one reads from NDB and writes into another engine as unsafe:
      
        if (multi_engine && flags_some_set & HA_HAS_OWN_BINLOGGING)
          lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE);
    sql/sql_lex.cc:
      Added error ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
    sql/sql_lex.h:
      Added BINLOG_STMT_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
    3fad4e8d
sql_lex.cc 83.4 KB