• unknown's avatar
    Fix for BUG#4500 "set character set replicates incorrectly" · 4014c093
    unknown authored
    We must not reset the charset in slave after each statement, otherwise the SET CHARACTER SET is cancelled immediately.
    Instead, we write a SET CHARACTER SET DEFAULT to the master's binlog when needed (like we already do for SET FOREIGN_KEY_CHECKS);
    such writing is not necessary in 4.1 (in 4.1 the bug does not exist, as the SET ONE_SHOT syntax is used).
    I have written a test and it works, but I'm not pushing the test as it requires building with all charsets.
    I have noticed differences between what is inserted in the master's table in 4.0 and 4.1, and alerted Bar.
    
    
    sql/log.cc:
      When SET CHARACTER SET has been used, we must reset the charset after the writing the statement, in the binlog.
      In 4.1, this resetting is already achieved by the SET ONE_SHOT syntax.
    sql/log_event.cc:
      In slave, we must not simply reset the charset after each statement: if we do this, the charset gets
      immediately after executing the SET CHARACTER SET! (BUG#4500).
    4014c093
log_event.cc 71.7 KB