[MDEV-27940] Instant alter drop index not supported in 10.4.24 Created: 2022-02-24  Updated: 2022-05-10  Resolved: 2022-05-10

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Documentation, Storage Engine - InnoDB
Affects Version/s: 10.4.24
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Bob Dempsey Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7 Source build


Issue Links:
Relates
relates to MDEV-13134 Introduce ALTER TABLE attributes ALGO... Closed

 Description   

Documentation at https://mariadb.com/kb/en/innodb-online-ddl-operations-with-the-instant-alter-algorithm/#alter-table-drop-index-and-drop-index states that 10.4 supports DROP INDEX ..., ALGORITHM=INSTANT, but it does not.

This is what I get when I run the example from that URL:

MariaDB [(none)]> \s
--------------
./bin/mysql  Ver 15.1 Distrib 10.4.24-MariaDB, for Linux (x86_64) using readline 5.1
 
Connection id:		8
Current database:	
Current user:		bdempsey@localhost
SSL:			Cipher in use is DHE-RSA-AES256-GCM-SHA384
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.4.24-MariaDB-debug Source distribution
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	latin1
Db     characterset:	latin1
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/home/bdempsey/mariadb/10.2/data/mysql.sock
Uptime:			1 min 8 sec
 
Threads: 6  Questions: 4  Slow queries: 0  Opens: 17  Flush tables: 1  Open tables: 10  Queries per second avg: 0.058
--------------
 
MariaDB [foo]> CREATE OR REPLACE TABLE tab (
    ->    a int PRIMARY KEY,
    ->    b varchar(50),
    ->    c varchar(50),
    ->    INDEX b_index (b)
    -> );
Query OK, 0 rows affected (0.053 sec)
 
MariaDB [foo]> SET SESSION alter_algorithm='INSTANT';
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [foo]> ALTER TABLE tab DROP INDEX b_index;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY



 Comments   
Comment by Marko Mäkelä [ 2022-02-24 ]

Because DROP INDEX will take time proportional to the size of the index (to traverse not the index tree, but the linked list of allocated page numbers), it does not belong to the ALGORITHM=INSTANT subset of ALGORITHM=INPLACE. It is allowed by ALGORITHM=NOCOPY.

The unfortunately named ALGORITHM=INPLACE allows the table to be rebuilt (copied), while ALGORITHM=NOCOPY does not allow that. A name like ALGORITHM=ENGINE would have been more appropriate for the generic native ALTER TABLE.

Comment by Ian Gilfillan [ 2022-05-10 ]

The section has been removed.

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