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

If you create a TokuDB table with tokudb_enable_native_partition=on and restart the instance without the parameter, the instance crashes upon trying to read the table.

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.7.x, 8.0.x
    • Fix Version/s: None
    • Component/s: TokuDB

      Description

      To upgrade Percona Server for MySQL 5.7 to 8.0, you need to have all TokuDB tables using native partitioning. 

      If you create a TokuDB table using native partitioning and then you disable tokudb_enable_native_partition, MySQL crashes when attempting to read the partitions with the following stack trace:

      stack_bottom = 7f9dc2a65cf0 thread_stack 0x40000
      /usr/sbin/mysqld(my_print_stacktrace+0x3b)[0xf1444b]
      /usr/sbin/mysqld(handle_fatal_signal+0x471)[0xd4e981]
      /lib64/libpthread.so.0(+0xf5d0)[0x7f9dc247d5d0]
      /usr/sbin/mysqld(_Z22mysql_unpack_partitionP3THDPcjP5TABLEbP10handlertonPb+0x611)[0xc81c91]
      /usr/sbin/mysqld(_Z21open_table_from_shareP3THDP11TABLE_SHAREPKcjjjP5TABLEb+0x6bb)[0xd0ffeb]
      /usr/sbin/mysqld(_Z10open_tableP3THDP10TABLE_LISTP18Open_table_context+0xf81)[0xc105c1]
      /usr/sbin/mysqld(_Z11open_tablesP3THDPP10TABLE_LISTPjjP19Prelocking_strategy+0x612)[0xc17582]
      /usr/sbin/mysqld(_Z21open_tables_for_queryP3THDP10TABLE_LISTj+0x5a)[0xc17eda]
      /usr/sbin/mysqld(_Z18mysqld_list_fieldsP3THDP10TABLE_LISTPKc+0x34)[0xcba604]
      /usr/sbin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0x13af)[0xc737cf]
      /usr/sbin/mysqld(_Z10do_commandP3THD+0x1df)[0xc749ef]
      /usr/sbin/mysqld(handle_connection+0x2c0)[0xd35500]
      /usr/sbin/mysqld(pfs_spawn_thread+0x1b4)[0xf2c6b4]
      /lib64/libpthread.so.0(+0x7dd5)[0x7f9dc2475dd5]
      /lib64/libc.so.6(clone+0x6d)[0x7f9dc0644ead]

       

      Steps to reproduce:

      On a PS with TokuDB installed:

      1 - edit my.cnf and add under [mysqld]

      tokudb_enable_native_partition=on

      2 - restart the mysql 

      root> service mysql restart

      3 - Check that tokudb native partitioning is enabled:

      mysql> show variables like 'tokudb_enable_native_partition';
      +--------------------------------+-------+
      | Variable_name                  | Value |
      +--------------------------------+-------+
      | tokudb_enable_native_partition | ON    |
      +--------------------------------+-------+
      1 row in set (0.00 sec)
      

       

      4 - Create TokuDB partitioned table:

      mysql> create database test;
      mysql> use test;
      mysql> CREATE TABLE `tokudb_table_with_native_partitioning` (  `id` bigint(20) NOT NULL AUTO_INCREMENT,
          ->  `dt` datetime NOT NULL,
          ->  PRIMARY KEY (`id`,`dt`)
          -> ) ENGINE=TokuDB DEFAULT CHARSET=utf8
          -> /*!50100 PARTITION BY RANGE (to_days(dt))
          -> (PARTITION p_min VALUES LESS THAN (0) ENGINE = TokuDB,
          ->  PARTITION p_200801 VALUES LESS THAN (733438) ENGINE = TokuDB,
          ->  PARTITION p_200802 VALUES LESS THAN (733467) ENGINE = TokuDB,
          ->  PARTITION p_202212 VALUES LESS THAN (738886) ENGINE = TokuDB,
          ->  PARTITION p_202301 VALUES LESS THAN (738917) ENGINE = TokuDB,
          ->  PARTITION p_max VALUES LESS THAN MAXVALUE ENGINE = TokuDB) */;
      Query OK, 0 rows affected (0.12 sec)
      

       5 - Go on your my.cnf and remove the line added on step 1:

      #tokudb_enable_native_partition=on

      6 - Restart MySQL 

      service mysql restart 

      7 - Check native partitioning is OFF: 

      mysql> show variables like 'tokudb_enable_native_partition';
      +--------------------------------+-------+
      | Variable_name                  | Value |
      +--------------------------------+-------+
      | tokudb_enable_native_partition | OFF  |
      +--------------------------------+-------+
      1 row in set (0.00 sec)
      

       8 - Try to access the database the table was created at:

      mysql> use test;

       

      MySQL will crash at this point.

       

      Workaround available:  Reenable tokudb_enable_native_partition=on on your my.cnf and restart the instance.

       

      Suggested behavior:

      Maybe throw an error when trying to read that table but keep the instance up. Or, if the decision is to have MySQL shutdown when the table is not accessible, then throw an error and shutdown cleanly. 

      Other option, if possible, is to check if the table was created with native partitioning and try to read it that way before crashing.

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                leonardo.bacchi.fernandes Leonardo Bacchi Fernandes
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: