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

Online DDL in Galera clusters

    XMLWordPrintable

Details

    Description

      Online DDL doesn't seems to work at all in a Galera cluster.

      CREATE TABLE test(
        id INT(11) NOT NULL PRIMARY KEY,
        description VARCHAR(20) DEFAULT NULL
      ) engine = innodb;
      

      wsrep_osu_method = 'TOI'; a certification error will be triggered if another session (same or different node) tries to insert.

      I kinda expected this, as it would be complex to certificate transactions across the cluster when tables are changing at different speeds.

      db01_session1> alter table test add c1 varchar(50), algorithm=inplace, lock=none;
      Query OK, 0 rows affected (12.60 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      db01_session2> insert into test (id, description) select max(id) + 1, 'description' from test;
      ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
      

      wsrep_osu_method = 'RSU'; other sessions will wait until DDL has finalized.

      Now, this was unexpected... I'm altering only the local node, and I can see Online DDL messages in the log. But the locking seems to be exclusive.

      db01_session1> set wsrep_osu_method = 'RSU';
      Query OK, 0 rows affected (0.02 sec)
       
      db01_session1> alter table test add c1 varchar(20), algorithm=inplace, lock=none;
      Query OK, 0 rows affected (1 min 2.29 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      db01_session2> insert into test (id, description) select max(id) + 1, 'description' from test;
      Query OK, 1 row affected (1 min 1.50 sec) <-- THIS INSERT HAS WAITED FOR THE DDL DURATION
      Records: 1  Duplicates: 0  Warnings: 0
      

      Log shows messages about Online DDL, and yes, it was inplace but locking.

      2017-03-27 10:38:34 140376044201728 [Note] WSREP: Member 1.0 (0a2f533fa3fd) desyncs itself from group
      2017-03-27 10:38:34 140376044201728 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 10001)
      2017-03-27 10:38:34 140376323062528 [Note] WSREP: Provider paused at 82f3a726-12d7-11e7-80a6-8391c64749a3:10001 (17791)
      2017-03-27 10:38:34 140376323062528 [Note] InnoDB: Online DDL : Start
      2017-03-27 10:38:34 140376323062528 [Note] InnoDB: Online DDL : Start reading clustered index of the table and create temporary files
      2017-03-27 10:38:39 140376323062528 [Note] InnoDB: Online DDL : End of reading clustered index of the table and create temporary files
      2017-03-27 10:38:39 140376323062528 [Note] InnoDB: Online DDL : Start merge-sorting index `PRIMARY` (1 / 1), estimated cost : 20.0000
      2017-03-27 10:38:39 140376323062528 [Note] InnoDB: Online DDL : merge-sorting has estimated 304 runs
      2017-03-27 10:39:00 140376323062528 [Note] InnoDB: Online DDL : End of  merge-sorting index `PRIMARY` (1 / 1)
      2017-03-27 10:39:00 140376323062528 [Note] InnoDB: Online DDL : Start building index `PRIMARY` (1 / 1), estimated cost : 30.0000
      2017-03-27 10:39:36 140376323062528 [Note] InnoDB: Online DDL : End of building index `PRIMARY` (1 / 1)
      2017-03-27 10:39:36 140376323062528 [Note] InnoDB: Online DDL : Completed
      2017-03-27 10:39:36 140376323062528 [Note] WSREP: resuming provider at 17791
      2017-03-27 10:39:36 140376323062528 [Note] WSREP: Provider resumed.
      2017-03-27 10:39:36 140376044201728 [Note] WSREP: Member 1.0 (0a2f533fa3fd) resyncs itself to group
      2017-03-27 10:39:36 140376044201728 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 10001)
      2017-03-27 10:39:36 140376044201728 [Note] WSREP: Member 1.0 (0a2f533fa3fd) synced with group.
      2017-03-27 10:39:36 140376044201728 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 10001)
      2017-03-27 10:39:36 140376418814720 [Note] WSREP: Synchronized with group, ready for connections
      2017-03-27 10:39:36 140376418814720 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
      

      Attachments

        Activity

          People

            jplindst Jan Lindström (Inactive)
            francisco.biete Francisco Biete
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.