• Brandon Nesterenko's avatar
    MDEV-28798: Previously Binlog Encrypted Master Segfaults on Binlog Dump with Using_Gtid=Slave_Pos · d3e7dba3
    Brandon Nesterenko authored
    Problem:
    ========
    A master can segfault if it can't set up decryption for its binary
    log during a binlog dump with Using_Gtid=Slave_Pos. If slave
    connects using GTID mode, the master will call into
    log.cc::get_gtid_list_event(), which iterate through binlog events
    looking for a Gtid_list_log_event. On an encrypted binlog that the
    master cannot decrypt, the first event will be a
    START_ENCRYPTION_EVENT which will call into the following decryption branch
    
    if (fdle->start_decryption((Start_encryption_log_event*) ev))
      errormsg= ‘Could not set up decryption for binlog.’;
    
    The event iteration however, does not stop in spite of this error.
    The master will try to read the next event, but segfault while
    trying to decrypt it because decryption failed to initialize.
    
    Solution:
    ========
    Break the event iteration if decryption cannot be set up.
    
    Reviewed By:
    ============
    Andrei Elkin <andrei.elkin@mariadb.com>
    d3e7dba3
log.cc 326 KB