Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25604

Atomic DDL: Binlog event written upon recovery does not have default database

    XMLWordPrintable

    Details

      Description

      When a binary log event is written as a result of DDL recovery, it does not set a default database, so if an object name is not fully-qualified, the object cannot be found upon executing such an event.

      Example of an event:

      bb-10.6-monty 387d673e + "fake" patch

      # at 384
      #700101  0:00:00 server id 1  end_log_pos 672 CRC32 0x0d19d9fa  Query   thread_id=0     exec_time=1620238373    error_code=0
      SET TIMESTAMP=0/*!*/;
      SET @@session.pseudo_thread_id=0/*!*/;
      SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/;
      SET @@session.sql_mode=1411383296/*!*/;
      SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
      /*!\C latin1 *//*!*/;
      SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
      SET @@session.lc_time_names=0/*!*/;
      SET @@session.collation_database=DEFAULT/*!*/;
      ALTER /* QNO 475 CON_ID 36 */ TABLE t3 CHANGE COLUMN IF EXISTS scol8 `c2` BIGINT UNSIGNED DEFAULT 0, LOCK=SHARED, ADD COLUMN IF NOT EXISTS icol5 INT UNSIGNED NULL DEFAULT 0, ALGORITHM=COPY, LOCK=SHARED, ENGINE=InnoDB
      /*!*/;
      DELIMITER ;
      # End of log file
      ROLLBACK /* added by mysqlbinlog */;
      /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
      /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
      

      Error on slave:

      2021-05-05 18:13:04 6 [ERROR] Slave SQL: Error 'Table '.t3' doesn't exist' on query. Default database: ''. Query: 'ALTER /* QNO 475 CON_ID 36 */ TABLE t3 CHANGE COLUMN IF EXISTS scol8 `c2` BIGINT UNSIGNED DEFAULT 0, LOCK=SHARED, ADD COLUMN IF NOT EXISTS icol5 INT UNSIGNED NULL DEFAULT 0, ALGORITHM=COPY, LOCK=SHARED, ENGINE=InnoDB', Gtid 0-1-1439, Internal MariaDB error code: 1146
      2021-05-05 18:13:04 6 [Warning] Slave: Table '.t3' doesn't exist Error_code: 1146
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              monty Michael Widenius
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration