Bug #86438 ATTEMPT TO DROP NONEXISTING DATAFILE FROM TABLESPACE GIVES 'INCORRECT FILE NAME'
Submitted: 24 May 2017 7:08 Modified: 19 Jun 2017 19:45
Reporter: Arnab Ray Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0.2 OS:Any
Assigned to: CPU Architecture:Any

[24 May 2017 7:08] Arnab Ray
Description:
When an attempt to drop a non-existing data file from a tablespace is made, the error returned is 'Incorrect file name <filename>'. This is slightly misleading and a clearer error specifying that the given file does not exist would be better.

How to repeat:
mysql> # Create logfile group
mysql> CREATE LOGFILE GROUP lg1
    ->   ADD UNDOFILE 'lg1_undofile.dat'
    ->   INITIAL_SIZE 1M
    ->   UNDO_BUFFER_SIZE = 1M
    ->   ENGINE=NDB;
Query OK, 0 rows affected (0,09 sec)

mysql> # Create tablespace using the logfile group
mysql> CREATE TABLESPACE ts1
    ->   ADD DATAFILE 'ts1_datafile.dat'
    ->   USE LOGFILE GROUP lg1
    ->   INITIAL_SIZE 1M
    ->   ENGINE NDB;
Query OK, 0 rows affected (0,10 sec)

mysql> # Drop datafile
mysql> ALTER TABLESPACE ts1
    ->   DROP DATAFILE 'ts1_datafile.dat'
    ->   ENGINE NDB;
Query OK, 0 rows affected (0,10 sec)

mysql> # Drop datafile again
mysql> ALTER TABLESPACE ts1
    ->   DROP DATAFILE 'ts1_datafile.dat'
    ->   ENGINE NDB;

Suggested fix:
Return an error saying that the data file specified does not exist
[1 Jun 2017 15:14] Dyre Tjeldvoll
Posted by developer:
 
After discussing this with the DD experts in the runtime team we agreed that we should use the term 'tablespace file' whenever possible as that is what the new DD uses internally. The idea being that an SE should be free to put any type of table in the tablespace. So this is what has been done in the committed patch.

It is of course unfortunate that this then becomes inconsistent with the current syntax, but still preferable as it follows the new SE-agnostic convention.
[19 Jun 2017 19:45] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.3 release, and here's the changelog entry:

A misleading error message was returned when attempting to drop a
nonexistent tablespace file.