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

Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys

Details

    Description

      • Create page compressed and encrypted table using some keys
      • Export and discard tablespace
      • Restart server using different keys
      • Import tablespace

      Stack:

      Thread pointer: 0x0x7fa4b34d0090
      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 = 0x7fa4a8088e70 thread_stack 0x48000
      mysys/stacktrace.c:246(my_print_stacktrace)[0x7fa4aff0f993]
      sql/signal_handler.cc:162(handle_fatal_signal)[0x7fa4af8bb098]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0)[0x7fa4aedb38d0]
      /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7fa4acb08107]
      /lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7fa4acb094e8]
      /dev/shm/plugins/ha_innodb.so(+0x19423c)[0x7fa4a3b1223c]
      /dev/shm/plugins/ha_innodb.so(+0x12fe8e)[0x7fa4a3aade8e]
      /dev/shm/plugins/ha_innodb.so(+0x12908a)[0x7fa4a3aa708a]
      /dev/shm/plugins/ha_innodb.so(+0x12997f)[0x7fa4a3aa797f]
      /dev/shm/plugins/ha_innodb.so(+0x25f731)[0x7fa4a3bdd731]
      /dev/shm/plugins/ha_innodb.so(+0x18799a)[0x7fa4a3b0599a]
      sql/handler.cc:4152(handler::ha_discard_or_import_tablespace(char))[0x7fa4af8c533c]
      sql/sql_table.cc:5583(mysql_discard_or_import_tablespace(THD*, TABLE_LIST*, bool))[0x7fa4af74a836]
      sql/sql_alter.cc:365(Sql_cmd_discard_import_tablespace::execute(THD*))[0x7fa4af7c1825]
      sql/sql_parse.cc:5611(mysql_execute_command(THD*))[0x7fa4af69835d]
      sql/sql_parse.cc:7214(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x7fa4af69c471]
      sql/sql_parse.cc:1477(dispatch_command(enum_server_command, THD*, char*, unsigned int))[0x7fa4af68b46f]
      sql/sql_parse.cc:1097(do_command(THD*))[0x7fa4af68a1a5]
      sql/sql_connect.cc:1350(do_handle_one_connection(THD*))[0x7fa4af7bcb98]
      sql/sql_connect.cc:1263(handle_one_connection)[0x7fa4af7bc8fc]
      perfschema/pfs.cc:1862(pfs_spawn_thread)[0x7fa4afa9e9d8]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4)[0x7fa4aedac0a4]
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fa4acbb904d]

      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
       
      --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
       
      --let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
      --let $MYSQLD_DATADIR = `SELECT @@datadir`
      --let SEARCH_RANGE = 10000000
      --let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
      --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-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
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      set global innodb_compression_algorithm = 1;
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
      SHOW WARNINGS;
      SHOW CREATE TABLE t1;
      INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
      FLUSH TABLE t1 FOR EXPORT;
      --echo # List before copying files
      --list_files $MYSQLD_DATADIR/test
      --copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
      --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
      UNLOCK TABLES;
       
      --sleep 5
      --echo # Tablespaces should be still encrypted
      --let SEARCH_PATTERN=foobar
      --echo # t1 yes on expecting NOT FOUND
      -- let SEARCH_FILE=$t1_IBD
      -- source include/search_pattern_in_file.inc
       
      ALTER TABLE t1 DISCARD TABLESPACE;
       
      --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-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
      --source include/restart_mysqld.inc
       
      SET GLOBAL innodb_file_format = `Barracuda`;
      SET GLOBAL innodb_file_per_table = ON;
      --echo # List after t1 DISCARD
      --list_files $MYSQLD_DATADIR/test
      --copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
      --copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
       
      ALTER TABLE t1 IMPORT TABLESPACE;
      SHOW CREATE TABLE t1;
      SELECT * FROM t1;
      --sleep 5
      --echo # Tablespaces should be still encrypted
      -- let SEARCH_FILE=$t1_IBD
      --let SEARCH_PATTERN=foobar
      --echo # t1 yes on expecting NOT FOUND
      -- let SEARCH_FILE=$t1_IBD
      -- source include/search_pattern_in_file.inc
       
      # 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

          commit 4d3f680c957b3e55fb65d207fd1362271d8f8068
          Author: Jan Lindström <jan.lindstrom@mariadb.com>
          Date: Mon Sep 14 14:11:23 2015 +0300

          MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys

          Add error handling to decryp function when decrypt fails during
          import.

          jplindst Jan Lindström (Inactive) added a comment - commit 4d3f680c957b3e55fb65d207fd1362271d8f8068 Author: Jan Lindström <jan.lindstrom@mariadb.com> Date: Mon Sep 14 14:11:23 2015 +0300 MDEV-8772 : Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys Add error handling to decryp function when decrypt fails during import.

          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.