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

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

    XMLWordPrintable

    Details

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

      Description

      Similar behavior to https://jira.percona.com/browse/PS-5809, but with RocksDB engine. 

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

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

      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 7faed997dcf0 thread_stack 0x40000
      /usr/sbin/mysqld(my_print_stacktrace+0x3b)[0xf1444b]
      /usr/sbin/mysqld(handle_fatal_signal+0x471)[0xd4e981]
      /lib64/libpthread.so.0(+0xf5d0)[0x7faed93955d0]
      /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)[0x7faed938ddd5]
      /lib64/libc.so.6(clone+0x6d)[0x7faed755cead]

       

      Steps to reproduce:

      On a PS with RocksDB installed:

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

      rocksdb_enable_native_partition=on

      2 - restart the mysql 

      root> service mysql restart

      3 - Check that rocksdb native partitioning is enabled: 

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

       4 - Create RocksDB partitioned table: 

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

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

      #rocksdb_enable_native_partition=on

      6 - Restart MySQL 

      service mysql restart 

      7 - Check native partitioning is OFF: 

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

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

      mysql> use test;

       

      MySQL will crash at this point.

       

      Workaround available:

      Re-add rocksdb_enable_native_partition=on to the 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: