[MDEV-23805] Make Online DDL to Instant DDL when table is empty Created: 2020-09-24  Updated: 2022-02-28  Resolved: 2021-11-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.8.0, 10.4.23, 10.5.14, 10.6.6, 10.7.2

Type: Task Priority: Major
Reporter: Thirunarayanan Balathandayuthapani Assignee: Marko Mäkelä
Resolution: Fixed Votes: 2
Labels: None

Issue Links:
Problem/Incident
causes MDEV-27962 Instant DDL downgrades the MDL when t... Closed
Relates
relates to MDEV-16131 Assertion `is_instant() || id == DICT... Closed
relates to MDEV-24730 Corruption in online ALTER TABLE with... Closed
relates to MDEV-515 innodb bulk insert Closed

 Description   

During prepare phase ha_innobase::prepare_inplace_alter_table() can check whether the table is empty and if it is then it can take S-lock on the
innodb table. So it eventually blocks concurrent DML to happen on the table. Skip the online alter phase and avoid the old table clustered index
read. InnoDB can rely on stat_n_rows in dict_table_t to find the table emptiness. InnoDB doesn't have to rely on MDL if relies on InnoDB lock.
InnoDB could reduce the time taken for DDL if table is empty.



 Comments   
Comment by Matthias Leich [ 2021-11-11 ]

bb-10.6-MDEV-23805 33b64f89803042849b16089754506532a46a7eff 2021-11-11T15:12:30+05:30 behaved well in RQG testing.

Comment by Marko Mäkelä [ 2021-11-17 ]

This simplification of locking may have made redundant the fixes of the race conditions MDEV-16131 and MDEV-24730. I had to adjust some test cases due to intermittent failures.

Generated at Thu Feb 08 09:25:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.