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

Galera: CREATE TABLE .. AS SELECT is not written into the binary log

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.28a-galera
    • 5.5.28a-galera
    • None
    • None

    Description

      It is a regression in revno 3352 (works on revno 3351, doesn't work on 3352).

      If a table is created as CREATE TABLE ... AS SELECT ..., normally it should trigger two events in the row binary log: one for CREATE DDL (statement format), and another one for Write_rows. It was so in revno 3351, but not anymore:

      revno 3352 (wrong):

      create table t1 as select 1;
      Query OK, 1 row affected (0.31 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      show binlog events;
      +-------------------+-----+-------------+-----------+-------------+-----------------------------------------------------+
      | Log_name          | Pos | Event_type  | Server_id | End_log_pos | Info                                                |
      +-------------------+-----+-------------+-----------+-------------+-----------------------------------------------------+
      | master-bin.000001 |   4 | Format_desc |         1 |         245 | Server ver: 5.5.27-MariaDB-debug-log, Binlog ver: 4 |
      | master-bin.000001 | 245 | Query       |         1 |         318 | BEGIN                                               |
      | master-bin.000001 | 318 | Table_map   |         1 |         359 | table_id: 33 (test.t1)                              |
      | master-bin.000001 | 359 | Write_rows  |         1 |         393 | table_id: 33 flags: STMT_END_F                      |
      | master-bin.000001 | 393 | Xid         |         1 |         420 | COMMIT /* xid=2 */                                  |
      +-------------------+-----+-------------+-----------+-------------+-----------------------------------------------------+
      5 rows in set (0.01 sec)

      revno 3351 (OK):

      create table t1 as select 1;
      Query OK, 1 row affected (0.34 sec)
      Records: 1  Duplicates: 0  Warnings: 0
       
      show binlog events;
      +-------------------+-----+-------------+-----------+-------------+---------------------------------------------------------------------+
      | Log_name          | Pos | Event_type  | Server_id | End_log_pos | Info                                                                |
      +-------------------+-----+-------------+-----------+-------------+---------------------------------------------------------------------+
      | master-bin.000001 |   4 | Format_desc |         1 |         245 | Server ver: 5.5.27-MariaDB-debug-log, Binlog ver: 4                 |
      | master-bin.000001 | 245 | Query       |         1 |         318 | BEGIN                                                               |
      | master-bin.000001 | 318 | Query       |         1 |         441 | use `test`; CREATE TABLE `t1` (
        `1` int(1) NOT NULL DEFAULT '0'
      ) |
      | master-bin.000001 | 441 | Table_map   |         1 |         482 | table_id: 33 (test.t1)                                              |
      | master-bin.000001 | 482 | Write_rows  |         1 |         516 | table_id: 33 flags: STMT_END_F                                      |
      | master-bin.000001 | 516 | Xid         |         1 |         543 | COMMIT /* xid=1 */                                                  |
      +-------------------+-----+-------------+-----------+-------------+---------------------------------------------------------------------+
      6 rows in set (0.00 sec)

      It means that if the binlog is used to replicate (or recreate) the data, the process will fail immediately on the Write_rows event, because the table won't exist.
      The problem is reproducible even if wsrep provider is not set.

      Attachments

        Activity

          People

            seppo Seppo Jaakola
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.