[MDEV-12371] Online DDL in Galera clusters Created: 2017-03-27  Updated: 2019-12-12  Resolved: 2019-12-12

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Galera, Storage Engine - InnoDB
Affects Version/s: 10.0.19-galera, 10.1.21, 10.2.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Francisco Biete Assignee: Jan Lindström (Inactive)
Resolution: Won't Fix Votes: 0
Labels: galera, innodb
Environment:

CentOS 6 x86_64



 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.



 Comments   
Comment by Jan Lindström (Inactive) [ 2019-12-12 ]

Support of 10.0-galera has ended.

Generated at Thu Feb 08 07:57:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.