Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
A ticket was raised earlier as a MariaDB bug that when a SELECT is executing on a table, parallel TRUNCATE waits for the Metadata Lock. After some explanation of this behavior and successful reproduction of this in their test environment, It was categorized as not a BUG.
However, they still want this TRUNCATE behaviour changed and requesting it as a new FEATURE where they could pass an additional parameter to the TRUNCATE statement and it will ignore all the LOCKS on the table and proceed with its DROP/RECREATE, aborting all SELECT's that are using this table. This is how Oracle does it.
This according to them is critical as it impacts their daily operations.
Attachments
Issue Links
- relates to
-
MDEV-13564 TRUNCATE TABLE and undo tablespace truncation are not compatible with Mariabackup
-
- Closed
-
I think that there are two parts of this feature request. The first part is the metadata locking, which takes place in the SQL layer.
The second part is the implementation of TRUNCATE TABLE inside storage engines. When it comes to InnoDB, it should be technically feasible to relax the locking requirements. If InnoDB internally implemented TRUNCATE as a RENAME TABLE, CREATE TABLE and deferred DROP TABLE, any concurrently running SELECT would not be a problem; the SELECT could keep running, and once all handles are closed, the original table could be dropped. This would also make InnoDB more backup-friendly (
MDEV-13564). Implementing this would depend onMDEV-14717, which is present in MariaDB 10.3.