Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-4901

8.0 cannot drop database with TokuDB tables if tokudb_dir_per_db=ON

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Duplicate
    • Affects Version/s: 8.0, Not 5.7
    • Fix Version/s: None
    • Component/s: TokuDB
    • Labels:
      None

      Description

      So if we have a database with tables and tokudb_dir_per_db=ON (which it is by default) we cannot drop that database in 8.0.
      Current workaround is to drop tables first and then drop database - this works.
      I have reproduced this on 8.0.12 and cannot reproduce it with 5.7.23 TokuDB or with 8.0 InnoDB/RocksDB.

      Test case:

      create database test;
      use test;
      create table t1 (a int primary key) engine=tokudb;
      drop database test;
      

      Here's how it looks in TokuDB 8.0 with tokudb_dir_per_db=ON:

      ###
      ### TokuDB 8.0 tokudb_dir_per_db=ON
      ###
      mysql> create database test;
      Query OK, 1 row affected (0.01 sec)
      
      mysql> use test;
      Database changed
      
      mysql> create table t1 (a int primary key) engine=tokudb;
      Query OK, 0 rows affected (0.12 sec)
      
      mysql> drop database test;
      ERROR 1010 (HY000): Error dropping database (can't rmdir './test/', errno: 17 - File exists)
      
      mysql> show variables like '%tokudb_dir_per_db%';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | tokudb_dir_per_db | ON    |
      +-------------------+-------+
      1 row in set (0.00 sec)
      

      Here's some other working combinations:

      ###
      ### TokuDB 8.0 tokudb_dir_per_db=OFF
      ###
      mysql> show variables like 'tokudb_dir_per_db';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | tokudb_dir_per_db | OFF   |
      +-------------------+-------+
      1 row in set (0.00 sec)
      
      mysql> create database test;
      Query OK, 1 row affected (0.01 sec)
      
      mysql> use test;
      Database changed
      mysql> create table t1 (a int primary key) engine=tokudb;
      Query OK, 0 rows affected (0.10 sec)
      
      mysql> drop database test;
      Query OK, 1 row affected (0.16 sec)
      
      ###
      ### PS 5.7.23 tokudb_dir_per_db=ON
      ###
      5.7.23>show variables like 'tokudb_dir_per_db';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | tokudb_dir_per_db | ON    |
      +-------------------+-------+
      1 row in set (0.00 sec)
      
      5.7.23>create database test;
      Query OK, 1 row affected (0.00 sec)
      
      5.7.23>use test;
      Database changed
      5.7.23>create table t1 (a int primary key) engine=tokudb;
      Query OK, 0 rows affected (0.09 sec)
      
      5.7.23>drop database test;
      Query OK, 1 row affected (0.00 sec)
      
      5.7.23>create database test;
      Query OK, 1 row affected (0.00 sec)
      
      ###
      ### PS 5.7.23 tokudb_dir_per_db=OFF
      ###
      5.7.23>use test;
      Database changed
      5.7.23>create table t1 (a int primary key) engine=tokudb;
      Query OK, 0 rows affected (0.08 sec)
      
      5.7.23>drop database test;
      Query OK, 1 row affected (0.01 sec)
      
      5.7.23>show variables like 'tokudb_dir_per_db';
      +-------------------+-------+
      | Variable_name     | Value |
      +-------------------+-------+
      | tokudb_dir_per_db | OFF   |
      +-------------------+-------+
      1 row in set (0.01 sec)
      
      ###
      ### InnoDB 8.0
      ###
      mysql> create database test;
      Query OK, 1 row affected (0.09 sec)
      
      mysql> use test;
      Database changed
      mysql> create table t1 (a int primary key) engine=innodb;
      Query OK, 0 rows affected (0.09 sec)
      
      mysql> drop database test;
      Query OK, 1 row affected (0.15 sec)
      
      ###
      ### RocksDB 8.0
      ###
      mysql> create database test;
      Query OK, 1 row affected (0.02 sec)
      
      mysql> use test;
      Database changed
      mysql> create table t1 (a int primary key) engine=rocksdb;
      Query OK, 0 rows affected (0.03 sec)
      
      mysql> drop database test;
      Query OK, 1 row affected (0.07 sec)
      

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  tomislav.plavcic@percona.com Tomislav Plavcic
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 30 minutes
                    30m