• Marko Mäkelä's avatar
    MDEV-27274: DROP TABLE does not delete detached InnoDB files · 8c1c6130
    Marko Mäkelä authored
    In commit 1bd681c8 (MDEV-25506 part 3)
    the way how DDL transactions delete files was rewritten.
    Only files that are actually attached to InnoDB tablespaces would be
    deleted, and only after the DDL transaction was durably committed.
    
    After a failed ALTER TABLE...IMPORT TABLESPACE, any data files that
    the user might have moved to the data directory will not be attached
    to the InnoDB data dictionary. Therefore, DROP TABLE would not
    attempt to delete those files, and a subsequent CREATE TABLE would
    fail. The logic was that the user who created the files outside the
    DBMS is still the owner of those files, and InnoDB should not delete
    those files because an "ownership transfer" (IMPORT TABLESPACE) was
    not successfully completed.
    
    However, not deleting those detached files could surprise users.
    
    ha_innobase::delete_table(): Even if no tablespace exists, try to
    delete any files that might match the table name.
    
    Reviewed by: Thirunarayanan Balathandayuthapani
    8c1c6130
import_bugs.test 1.26 KB