Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8769

Server crash at file btr0btr.ic line 122 when defragmenting encrypted table using incorrect keys

    XMLWordPrintable

Details

    • 10.1.8-1

    Description

      • Create encrypted table using some keys
      • Restart server with different keys and innodb-defragment=1
      • optimize table (defragment table)

      Stack:

      hread pointer: 0x0x7f3388c63060
      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 = 0x7f337c2bfe70 thread_stack 0x48000
      mysys/stacktrace.c:246(my_print_stacktrace)[0x7f33854f6993]
      sql/signal_handler.cc:162(handle_fatal_signal)[0x7f3384ea2098]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0)[0x7f338439a8d0]
      /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7f33820ef107]
      /lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f33820f04e8]
      include/btr0btr.ic:124(btr_page_get_level_low)[0x7f3385290787]
      btr/btr0defragment.cc:221(btr_defragment_add_index(dict_index_t*, bool))[0x7f33852917a2]
      handler/ha_innodb.cc:12703(ha_innobase::defragment_table(char const*, char const*, bool))[0x7f33850b310c]
      handler/ha_innodb.cc:13920(ha_innobase::optimize(THD*, st_ha_check_opt*))[0x7f33850b54eb]
      sql/handler.cc:4067(handler::ha_optimize(THD*, st_ha_check_opt*))[0x7f3384eac0c3]
      sql/sql_admin.cc:750(mysql_admin_table)[0x7f3384db4e99]
      sql/sql_admin.cc:1246(Sql_cmd_optimize_table::execute(THD*))[0x7f3384db6c2a]
      sql/sql_parse.cc:5611(mysql_execute_command(THD*))[0x7f3384c7f35d]
      sql/sql_parse.cc:7214(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x7f3384c83471]
      sql/sql_parse.cc:1477(dispatch_command(enum_server_command, THD*, char*, unsigned int))[0x7f3384c7246f]
      sql/sql_parse.cc:1097(do_command(THD*))[0x7f3384c711a5]
      sql/sql_connect.cc:1350(do_handle_one_connection(THD*))[0x7f3384da3b98]
      sql/sql_connect.cc:1263(handle_one_connection)[0x7f3384da38fc]
      perfschema/pfs.cc:1862(pfs_spawn_thread)[0x7f33850859d8]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4)[0x7f33843930a4]
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f33821a004d]

      Test case:

      --source include/have_innodb.inc
      # embedded does not support restart
      -- source include/not_embedded.inc
      -- source include/not_valgrind.inc
      # Avoid CrashReporter popup on Mac
      -- source include/not_crashrep.inc
      #
      # MDEV-8750: Server crashes in page_cur_is_after_last on altering table using a wrong encryption key
      #
      call mtr.add_suppression("InnoDB: Block in space_id .* in file test/.* encrypted");
      call mtr.add_suppression("InnoDB: However key management plugin or used key_id 1 is not found or used encryption algorithm or method does not match.");
      call mtr.add_suppression("InnoDB: Marking tablespace as missing. You may drop this table or install correct key management plugin and key file.");
      call mtr.add_suppression(".*InnoDB: Cannot open table test/.* from the internal data dictionary of InnoDB though the .frm file for the table exists. See .* for how you can resolve the problem.");
      call mtr.add_suppression("InnoDB: .ibd file is missing for table test/.*");
      # Suppression for builds where file_key_management plugin is linked statically
      call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys1.txt
      1;770A8A65DA156D24EE2A093277530142
      4;770A8A65DA156D24EE2A093277530143
      EOF
       
      --exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      --let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
      --let $MYSQLD_DATADIR = `SELECT @@datadir`
       
      --disable_query_log
      let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
      let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
      --enable_query_log
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTION_KEY_ID=4;
      INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
       
      --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --shutdown_server
      --source include/wait_until_disconnected.inc
       
      --write_file $MYSQLTEST_VARDIR/keys2.txt
      1;770A8A65DA156D24EE2A093277530142
      4;770A8A65DA156D24EE2A093277530144
      EOF
       
      --exec echo "restart:--innodb-encrypt-tables --innodb-defragment=1 --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --enable_reconnect
      --source include/wait_until_connected_again.inc
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
       
      OPTIMIZE TABLE t1;
       
      --remove_file $MYSQLTEST_VARDIR/keys1.txt
      --remove_file $MYSQLTEST_VARDIR/keys2.txt
       
      # reset system
      --disable_query_log
      EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
      EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
      --enable_query_log

      Attachments

        Activity

          People

            jplindst Jan Lindström (Inactive)
            jplindst Jan Lindström (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.