[MDEV-32786] Optimization of DROP TABLE for Galera Created: 2023-11-13 Updated: 2023-12-22 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Galera, Locking |
| Fix Version/s: | 11.5 |
| Type: | Task | Priority: | Major |
| Reporter: | Michael Widenius | Assignee: | Daniele Sciascia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
I got this from a MariaDB user: ----------------
----------------
---------------- SESSION1 SESSION2 SESSION3 SESSION4
---
--- |
| Comments |
| Comment by Marko Mäkelä [ 2023-11-13 ] |
|
I think that the problem might be that the time-consuming file deletion would still be executed while the DDL operation is protected by MDL_EXCLUSIVE. I believe that for this to be fixed properly, we should refactor the API to mark DDL transaction boundaries. DROP TABLE is analogous to the DELETE statement. On DML, the locking works like this:
The simplest analogy for DROP TABLE would be like this:
In |
| Comment by Daniele Sciascia [ 2023-12-06 ] |
|
DDLs in Galera cluster are by default executed in so called TOI (total order isolation) mode. The DROP TABLE operation shown in the ticket, essentially uses one replication round to order the operation and execute it in isolation. Once ordered, the DDL acquires Galera's commit order critical section (preventing other operations to commit). The commit order critical section is then released after the DDL releases its MDL locks.
Shortening the duration of the MDL locks would shorten commit order critical section. Alternatively, one could rely on NBO (non blocking operation) mode for DDL execution. NBO would allow executing the DDL, in a way that doesn't block concurrent non-conflicting operations. Thus allowing concurrent executions of operations like INSERT to t1 while DROP TABLE bigtable1 is in progress. |