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

InnoDB; Failing assertion: crypt_data->type == 1

Details

    Description

      Let below test crash at least once, after that crash recovery will fail always to this same asertion.

      # 2015-05-18T15:12:27 [8106] | 2015-05-18 15:08:27 7f9b20234780  InnoDB: Assertion failure in thread 140304235841408 in file fil0crypt.cc line 771
      # 2015-05-18T15:12:27 [8106] | InnoDB: Failing assertion: crypt_data->type == 1
      # 2015-05-18T15:12:27 [8106] | InnoDB: We intentionally generate a memory trap.
      # 2015-05-18T15:12:27 [8106] | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
      # 2015-05-18T15:12:27 [8106] | InnoDB: If you get repeated assertion failures or crashes, even
      # 2015-05-18T15:12:27 [8106] | InnoDB: immediately after the mysqld startup, there may be
      # 2015-05-18T15:12:27 [8106] | InnoDB: corruption in the InnoDB tablespace. Please refer to
      # 2015-05-18T15:12:27 [8106] | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
      # 2015-05-18T15:12:27 [8106] | InnoDB: about forcing recovery.
      # 2015-05-18T15:12:27 [8106] | 150518 15:08:27 [ERROR] mysqld got signal 6 ;
      # 2015-05-18T15:12:27 [8106] | This could be because you hit a bug. It is also possible that this binary
      # 2015-05-18T15:12:27 [8106] | or one of the libraries it was linked against is corrupt, improperly built,
      # 2015-05-18T15:12:27 [8106] | or misconfigured. This error can also be caused by malfunctioning hardware.
      # 2015-05-18T15:12:27 [8106] | 
      # 2015-05-18T15:12:27 [8106] | To report this bug, see http://kb.askmonty.org/en/reporting-bugs
      # 2015-05-18T15:12:27 [8106] | 
      # 2015-05-18T15:12:27 [8106] | We will try our best to scrape up some info that will hopefully help
      # 2015-05-18T15:12:27 [8106] | diagnose the problem, but since we have already crashed, 
      # 2015-05-18T15:12:27 [8106] | something is definitely wrong and this may fail.
      # 2015-05-18T15:12:27 [8106] | 
      # 2015-05-18T15:12:27 [8106] | Server version: 10.1.5-MariaDB-wsrep-debug-log
      # 2015-05-18T15:12:27 [8106] | key_buffer_size=134217728
      # 2015-05-18T15:12:27 [8106] | read_buffer_size=131072
      # 2015-05-18T15:12:27 [8106] | max_used_connections=0
      # 2015-05-18T15:12:27 [8106] | max_threads=153
      # 2015-05-18T15:12:28 [8106] | thread_count=0
      # 2015-05-18T15:12:28 [8106] | It is possible that mysqld could use up to 
      # 2015-05-18T15:12:28 [8106] | key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467322 K  bytes of memory
      # 2015-05-18T15:12:28 [8106] | Hope that's ok; if not, decrease some variables in the equation.
      # 2015-05-18T15:12:28 [8106] | 
      # 2015-05-18T15:12:28 [8106] | Thread pointer: 0x0x0
      # 2015-05-18T15:12:28 [8106] | Attempting backtrace. You can use the following information to find out
      # 2015-05-18T15:12:28 [8106] | where mysqld died. If you see no messages after this, something went
      # 2015-05-18T15:12:28 [8106] | terribly wrong...
      # 2015-05-18T15:12:28 [8106] | stack_bottom = 0x0 thread_stack 0x48000
      # 2015-05-18T15:12:28 [8106] | mysys/stacktrace.c:246(my_print_stacktrace)[0x7f9b20f9301c]
      # 2015-05-18T15:12:28 [8106] | sql/signal_handler.cc:155(handle_fatal_signal)[0x7f9b20940075]
      # 2015-05-18T15:12:28 [8106] | /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f9b1e759340]
      # 2015-05-18T15:12:28 [8106] | /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7f9b1ddb0cc9]
      # 2015-05-18T15:12:28 [8106] | /lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f9b1ddb40d8]
      # 2015-05-18T15:12:28 [8106] | fil/fil0crypt.cc:775(fil_space_decrypt(fil_space_crypt_struct*, unsigned char const*, unsigned long, unsigned char*))[0x7f9b20eeb5dc]
      # 2015-05-18T15:12:28 [8106] | fil/fil0crypt.cc:846(fil_space_decrypt(unsigned long, unsigned char const*, unsigned long, unsigned char*))[0x7f9b20eeb7f0]
      # 2015-05-18T15:12:28 [8106] | buf/buf0buf.cc:6038(buf_page_decrypt_after_read(buf_page_t*))[0x7f9b20e745ce]
      # 2015-05-18T15:12:28 [8106] | buf/buf0buf.cc:4323(buf_page_io_complete(buf_page_t*))[0x7f9b20e70b0e]
      # 2015-05-18T15:12:28 [8106] | buf/buf0rea.cc:261(buf_read_page_low(dberr_t*, bool, unsigned long, unsigned long, unsigned long, unsigned long, long, unsigned long, trx_t*))[0x7f9b20e8e953]
      # 2015-05-18T15:12:28 [8106] | buf/buf0rea.cc:465(buf_read_page(unsigned long, unsigned long, unsigned long, trx_t*))[0x7f9b20e8ed95]
      # 2015-05-18T15:12:28 [8106] | buf/buf0buf.cc:2789(buf_page_get_gen(unsigned long, unsigned long, unsigned long, unsigned long, buf_block_t*, unsigned long, char const*, unsigned long, mtr_t*))[0x7f9b20e6d1bc]
      # 2015-05-18T15:12:28 [8106] | dict/dict0boot.cc:56(dict_hdr_get(mtr_t*))[0x7f9b20e95e7c]
      # 2015-05-18T15:12:28 [8106] | dict/dict0boot.cc:286(dict_boot())[0x7f9b20e964d2]
      # 2015-05-18T15:12:28 [8106] | srv/srv0start.cc:2543(innobase_start_or_create_for_mysql())[0x7f9b20dddd5d]
      # 2015-05-18T15:12:28 [8106] | handler/ha_innodb.cc:4107(innobase_init)[0x7f9b20c76dd9]
      # 2015-05-18T15:12:28 [8106] | sql/handler.cc:512(ha_initialize_handlerton(st_plugin_int*))[0x7f9b20941fde]
      # 2015-05-18T15:12:28 [8106] | sql/sql_plugin.cc:1403(plugin_initialize)[0x7f9b2072ca24]
      # 2015-05-18T15:12:28 [8106] | sql/sql_plugin.cc:1675(plugin_init(int*, char**, int))[0x7f9b2072d5e7]
      # 2015-05-18T15:12:28 [8106] | sql/mysqld.cc:5039(init_server_components)[0x7f9b2064fa1e]
      # 2015-05-18T15:12:28 [8106] | sql/mysqld.cc:5631(mysqld_main(int, char**))[0x7f9b20650b52]
      # 2015-05-18T15:12:28 [8106] | sql/main.cc:26(main)[0x7f9b20646895]
      # 2015-05-18T15:12:28 [8106] | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f9b1dd9bec5]
      # 2015-05-18T15:12:28 [8106] | /home/jan/mysql/10.1-encryption/sql/mysqld(+0x3d5788)[0x7f9b20646788]
      # 2015-05-18T15:12:28 [8106] | The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      # 2015-05-18T15:12:28 [8106] | information that should help you find out what is causing the crash.
      # 2015-05-18T15:12:28 [8106] | Writing a core file
      # 2015-05-18T15:12:28 [8106] | Aborted (core dumped)

      query:
              INSERT IGNORE INTO _table ( _field ) VALUES ( _digit ), ( _digit ), ( _digit ), ( _digit ) |
              DELETE FROM _table WHERE `pk` > _digit LIMIT 4 ;
       
      thread2:
              set_encrypt_option |
              create_or_replace;
       
      set_encrypt_option:
              SET GLOBAL innodb_encrypt_tables = enc_tables |
              SET GLOBAL innodb_encryption_threads = _digit |
              SET GLOBAL innodb_scrub_log_speed = _smallint_unsigned 
      ;
       
      encrypt_on_off:
              ON | OFF ;
       
      enc_tables:
              ON | OFF | 'FORCE' ;
       
      create_or_replace:
              CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM _table ;

      RQG data template enc2.zz

      $tables = {
      	rows => [0, 1, 10 ],
      	pk => [ 'int auto_increment' ]
      };
       
      $fields = {
      	types => [ 'int' ],
      	indexes => [ 'key', undef ]
      };
       
      $data = {
      	numbers => [ 'digit', 'null', undef ],
      	strings => [ 'letter', 'english' ],
      	blobs => [ 'data' ],
      	temporals => ['date', 'year', 'null', undef ]
      }

      RQG command line (use lp:~elenst/randgen/mariadb-patches):

      perl ./runall-new.pl --threads=2 --duration=400 --queries=100M --mysqld=--plugin-load-add=file_key_management.so --mysqld=--file_key_management_filename=<your basedir>/mysql-test/std_data/keys.txt --grammar=enc2.yy --gendata=enc2.zz --mtr-build-thread=73 --basedir1=<your basedir> --vardir1=<your vardir>

      See MDEV-8171 for instructions how to run the same test several times.

      Attachments

        Issue Links

          Activity

            No need for crash recovery. mtr test case:

            #
            # MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1 
            #
             
            SET GLOBAL innodb_encryption_threads = 4;
             
            CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
            INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES  (NULL, NULL, -474021888) ,  (1, NULL, NULL) ,  (1141047296, NULL, NULL) ,  (NULL, NULL, NULL) ,  (NULL, NULL, 1) ,  (NULL, NULL, 9) ,  (0, NULL, 1225785344) ,  (NULL, NULL, 1574174720) ,  (2, NULL, NULL) ,  (6, NULL, 3);
             
            CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
             
            CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
             
            INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES  (4, NULL, NULL);
            INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
            INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
            INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
             
            --connect (con1,localhost,root,,test)
            --connect (con2,localhost,root,,test)
             
            --disable_abort_on_error
            --disable_warnings
             
            let $i = 2000;
            while ($i)
            {
            connection con1;
            send SET GLOBAL innodb_encrypt_tables = ON;
            connection default;
            CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
            connection con2;
            send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
            connection default;
            send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`;
            connection con1;
            --reap;
            send SET GLOBAL innodb_encrypt_tables = OFF;
            connection con2;
            --reap;
            connection default;
            --reap;
            send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
            connection con2;
            send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
            connection con1;
            --reap;
            send SET GLOBAL innodb_encrypt_tables = FORCE;
            connection default;
            --reap;
            send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
            connection con2;
            --reap;
            CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
            CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`;
            connection con1; 
            --reap;
            connection default;
            --reap;
            Sdec $i;
            }
             
            connection default;
            drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
            --disconnect con1;
            --disconnect con2;
            --enable_abort_on_error
            --enable_warnings
            SET GLOBAL innodb_encryption_threads = 0;

            stack:

            hread 1 (Thread 0x7f10503af700 (LWP 23667)):
            #0  0x00007f1057d54621 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
            #1  0x00007f105a5912aa in my_write_core (sig=6) at /home/jan/mysql/10.1-encryption/mysys/stacktrace.c:456
            #2  0x00007f1059f3e390 in handle_fatal_signal (sig=6) at /home/jan/mysql/10.1-encryption/sql/signal_handler.cc:266
            #3  <signal handler called>
            #4  0x00007f10573aecc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
            #5  0x00007f10573b20d8 in __GI_abort () at abort.c:89
            #6  0x00007f10573a7b86 in __assert_fail_base (fmt=0x7f10574f8830 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f105a69ab76 "scheme->type == 1", file=file@entry=0x7f105a69ab28 "/home/jan/mysql/10.1-encryption/sql/encryption.cc", line=line@entry=172, function=function@entry=0x7f105a69ac60 <do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int (*)(unsigned char const*, unsigned int, unsigned char*, unsigned int*, unsigned char const*, unsigned int, unsigned char const*, unsigned int, int, unsigned int, unsigned int))::__PRETTY_FUNCTION__> "int do_crypt(const unsigned char*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, long long unsigned int, encrypt_decrypt_func)") at assert.c:92
            #7  0x00007f10573a7c32 in __GI___assert_fail (assertion=0x7f105a69ab76 "scheme->type == 1", file=0x7f105a69ab28 "/home/jan/mysql/10.1-encryption/sql/encryption.cc", line=172, function=0x7f105a69ac60 <do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int (*)(unsigned char const*, unsigned int, unsigned char*, unsigned int*, unsigned char const*, unsigned int, unsigned char const*, unsigned int, int, unsigned int, unsigned int))::__PRETTY_FUNCTION__> "int do_crypt(const unsigned char*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, long long unsigned int, encrypt_decrypt_func)") at assert.c:101
            #8  0x00007f1059ecd076 in do_crypt (src=0x7f1018004026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", slen=16338, dst=0x7f1050e14026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", dlen=0x7f10503ab254, scheme=0x7f105c1f5400, key_version=1, i32_1=0, i32_2=455, i64=18913978, crypt=0x7f105a5ae1bb <my_aes_decrypt_cbc(uchar const*, uint, uchar*, uint*, uchar const*, uint, uchar const*, uint, int)>) at /home/jan/mysql/10.1-encryption/sql/encryption.cc:172
            #9  0x00007f1059ecd236 in encryption_scheme_decrypt (src=0x7f1018004026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", slen=16338, dst=0x7f1050e14026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", dlen=0x7f10503ab254, scheme=0x7f105c1f5400, key_version=1, i32_1=0, i32_2=455, i64=18913978) at /home/jan/mysql/10.1-encryption/sql/encryption.cc:211
            #10 0x00007f105241765e in fil_space_decrypt (crypt_data=0x7f105c1f5400, src_frame=0x7f1018004000 "\177\002\343\256", page_size=16384, dst_frame=0x7f1050e14000 "\177\002\343\256") at /home/jan/mysql/10.1-encryption/storage/innobase/fil/fil0crypt.cc:798
            #11 0x00007f1052417772 in fil_space_decrypt (space=0, src_frame=0x7f1018004000 "\177\002\343\256", page_size=16384, dst_frame=0x7f1050e14000 "\177\002\343\256") at /home/jan/mysql/10.1-encryption/storage/innobase/fil/fil0crypt.cc:843
            #12 0x00007f10523a289d in buf_page_decrypt_after_read (bpage=0x7f1050665b40) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:5881
            #13 0x00007f105239ed99 in buf_page_io_complete (bpage=0x7f1050665b40, evict=false) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:4246
            #14 0x00007f10523bb18d in buf_read_page_low (err=0x7f10503ab47c, sync=true, mode=132, space=0, zip_size=0, unzip=0, tablespace_version=1, offset=455) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0rea.cc:216
            #15 0x00007f10523bb6b7 in buf_read_page (space=0, zip_size=0, offset=455) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0rea.cc:414
            #16 0x00007f105239b47f in buf_page_get_gen (space=0, zip_size=0, offset=455, rw_latch=2, guess=0x0, mode=10, file=0x7f10526a9fa8 "/home/jan/mysql/10.1-encryption/storage/innobase/include/trx0undo.ic", line=171, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:2764
            #17 0x00007f10525f7044 in trx_undo_page_get (space=0, zip_size=0, page_no=455, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/include/trx0undo.ic:170
            #18 0x00007f10525fa640 in trx_undo_reuse_cached (trx=0x7f1020002888, rseg=0x7f105c2188d8, type=1, trx_id=27132, xid=0x7f1020002a18, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0undo.cc:1681
            #19 0x00007f10525fa9bc in trx_undo_assign_undo (trx=0x7f1020002888, type=1) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0undo.cc:1785
            #20 0x00007f10525e163c in trx_undo_report_row_operation (flags=0, op_type=1, thr=0x7f10201f0888, index=0x7f10201ef8a8, clust_entry=0x7f10201b0e98, update=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x7f10503ac168) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0rec.cc:1262
            #21 0x00007f105236f11c in btr_cur_ins_lock_and_undo (flags=0, cursor=0x7f10503ac320, entry=0x7f10201b0e98, thr=0x7f10201f0888, mtr=0x7f10503ac3a0, inherit=0x7f10503ac1e0) at /home/jan/mysql/10.1-encryption/storage/innobase/btr/btr0cur.cc:1174
            #22 0x00007f105236f761 in btr_cur_optimistic_insert (flags=0, cursor=0x7f10503ac320, offsets=0x7f10503ac2e0, heap=0x7f10503ac2f0, entry=0x7f10201b0e98, rec=0x7f10503ac2f8, big_rec=0x7f10503ac2e8, n_ext=0, thr=0x7f10201f0888, mtr=0x7f10503ac3a0) at /home/jan/mysql/10.1-encryption/storage/innobase/btr/btr0cur.cc:1394
            #23 0x00007f1052550f8c in row_ins_clust_index_entry_low (flags=0, mode=2, index=0x7f10201ef8a8, n_uniq=0, entry=0x7f10201b0e98, n_ext=0, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2500
            #24 0x00007f1052551fe4 in row_ins_clust_index_entry (index=0x7f10201ef8a8, entry=0x7f10201b0e98, thr=0x7f10201f0888, n_ext=0) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2896
            #25 0x00007f10525522fb in row_ins_index_entry (index=0x7f10201ef8a8, entry=0x7f10201b0e98, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2994
            #26 0x00007f10525525bb in row_ins_index_entry_step (node=0x7f10201f0630, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3071
            #27 0x00007f10525528cb in row_ins (node=0x7f10201f0630, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3211
            #28 0x00007f1052552c2c in row_ins_step (thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3336
            #29 0x00007f10525691d2 in row_insert_for_mysql (mysql_rec=0x7f10201ef298 "\375\004", prebuilt=0x7f10201f0118) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0mysql.cc:1372
            #30 0x00007f1052465f88 in ha_innodb::write_row (this=0x7f10201e8958, record=0x7f10201ef298 "\375\004") at /home/jan/mysql/10.1-encryption/storage/innobase/handler/ha_innodb.cc:7874
            #31 0x00007f1059f4c321 in handler::ha_write_row (this=0x7f10201e8958, buf=0x7f10201ef298 "\375\004") at /home/jan/mysql/10.1-encryption/sql/handler.cc:5871
            #32 0x00007f1059cf5299 in write_record (thd=0x7f105c0b8a70, table=0x7f10201ee670, info=0x7f1020014a50) at /home/jan/mysql/10.1-encryption/sql/sql_insert.cc:1854
            #33 0x00007f1059cf9d0e in select_insert::send_data (this=0x7f1020014a10, values=...) at /home/jan/mysql/10.1-encryption/sql/sql_insert.cc:3619
            #34 0x00007f1059d7da6e in end_send (join=0x7f1020014af8, join_tab=0x7f10200177c8, end_of_records=false) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:19104
            #35 0x00007f1059d7b881 in evaluate_join_record (join=0x7f1020014af8, join_tab=0x7f1020017480, error=0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:18208
            #36 0x00007f1059d7b175 in sub_select (join=0x7f1020014af8, join_tab=0x7f1020017480, end_of_records=false) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:17983
            #37 0x00007f1059d7a9c3 in do_select (join=0x7f1020014af8, fields=0x7f105c0bcff8, table=0x0, procedure=0x0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:17640
            #38 0x00007f1059d55e48 in JOIN::exec_inner (this=0x7f1020014af8) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:3098
            #39 0x00007f1059d53119 in JOIN::exec (this=0x7f1020014af8) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:2397
            #40 0x00007f1059d566ec in mysql_select (thd=0x7f105c0b8a70, rref_pointer_array=0x7f105c0bd158, tables=0x7f1020014228, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f1020014a10, unit=0x7f105c0bc7f0, select_lex=0x7f105c0bcee0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:3326
            #41 0x00007f1059d4c6c8 in handle_select (thd=0x7f105c0b8a70, lex=0x7f105c0bc728, result=0x7f1020014a10, setup_tables_done_option=0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:373
            #42 0x00007f1059d14d51 in mysql_execute_command (thd=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:3379
            #43 0x00007f1059d20c5b in mysql_parse (thd=0x7f105c0b8a70, rawbuf=0x7f10200138e8 "CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`", length=83, parser_state=0x7f10503ae200) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:7161
            #44 0x00007f1059d0fea8 in dispatch_command (command=COM_QUERY, thd=0x7f105c0b8a70, packet=0x7f105c0bf5d1 "CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`", packet_length=83) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:1462
            #45 0x00007f1059d0ec83 in do_command (thd=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:1090
            #46 0x00007f1059e3f9c9 in do_handle_one_connection (thd_arg=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_connect.cc:1347
            #47 0x00007f1059e3f721 in handle_one_connection (arg=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_connect.cc:1258
            #48 0x00007f105a1f0eff in pfs_spawn_thread (arg=0x7f105c0c48b0) at /home/jan/mysql/10.1-encryption/storage/perfschema/pfs.cc:1860
            #49 0x00007f1057d4f182 in start_thread (arg=0x7f10503af700) at pthread_create.c:312
            #50 0x00007f105747247d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

            jplindst Jan Lindström (Inactive) added a comment - - edited No need for crash recovery. mtr test case: # # MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1 #   SET GLOBAL innodb_encryption_threads = 4;   CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb; INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);   CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;   CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;   INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL); INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 ); INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 ); INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );   --connect (con1,localhost,root,,test) --connect (con2,localhost,root,,test)   --disable_abort_on_error --disable_warnings   let $i = 2000; while ($i) { connection con1; send SET GLOBAL innodb_encrypt_tables = ON; connection default; CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; connection con2; send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; connection default; send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; connection con1; --reap; send SET GLOBAL innodb_encrypt_tables = OFF; connection con2; --reap; connection default; --reap; send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; connection con2; send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; connection con1; --reap; send SET GLOBAL innodb_encrypt_tables = FORCE; connection default; --reap; send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; connection con2; --reap; CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; connection con1; --reap; connection default; --reap; Sdec $i; }   connection default; drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc; --disconnect con1; --disconnect con2; --enable_abort_on_error --enable_warnings SET GLOBAL innodb_encryption_threads = 0; stack: hread 1 (Thread 0x7f10503af700 (LWP 23667)): #0 0x00007f1057d54621 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61 #1 0x00007f105a5912aa in my_write_core (sig=6) at /home/jan/mysql/10.1-encryption/mysys/stacktrace.c:456 #2 0x00007f1059f3e390 in handle_fatal_signal (sig=6) at /home/jan/mysql/10.1-encryption/sql/signal_handler.cc:266 #3 <signal handler called> #4 0x00007f10573aecc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #5 0x00007f10573b20d8 in __GI_abort () at abort.c:89 #6 0x00007f10573a7b86 in __assert_fail_base (fmt=0x7f10574f8830 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f105a69ab76 "scheme->type == 1", file=file@entry=0x7f105a69ab28 "/home/jan/mysql/10.1-encryption/sql/encryption.cc", line=line@entry=172, function=function@entry=0x7f105a69ac60 <do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int (*)(unsigned char const*, unsigned int, unsigned char*, unsigned int*, unsigned char const*, unsigned int, unsigned char const*, unsigned int, int, unsigned int, unsigned int))::__PRETTY_FUNCTION__> "int do_crypt(const unsigned char*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, long long unsigned int, encrypt_decrypt_func)") at assert.c:92 #7 0x00007f10573a7c32 in __GI___assert_fail (assertion=0x7f105a69ab76 "scheme->type == 1", file=0x7f105a69ab28 "/home/jan/mysql/10.1-encryption/sql/encryption.cc", line=172, function=0x7f105a69ac60 <do_crypt(unsigned char const*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, unsigned long long, int (*)(unsigned char const*, unsigned int, unsigned char*, unsigned int*, unsigned char const*, unsigned int, unsigned char const*, unsigned int, int, unsigned int, unsigned int))::__PRETTY_FUNCTION__> "int do_crypt(const unsigned char*, unsigned int, unsigned char*, unsigned int*, st_encryption_scheme*, unsigned int, unsigned int, unsigned int, long long unsigned int, encrypt_decrypt_func)") at assert.c:101 #8 0x00007f1059ecd076 in do_crypt (src=0x7f1018004026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", slen=16338, dst=0x7f1050e14026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", dlen=0x7f10503ab254, scheme=0x7f105c1f5400, key_version=1, i32_1=0, i32_2=455, i64=18913978, crypt=0x7f105a5ae1bb <my_aes_decrypt_cbc(uchar const*, uint, uchar*, uint*, uchar const*, uint, uchar const*, uint, int)>) at /home/jan/mysql/10.1-encryption/sql/encryption.cc:172 #9 0x00007f1059ecd236 in encryption_scheme_decrypt (src=0x7f1018004026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", slen=16338, dst=0x7f1050e14026 "+\360\004\273\266s!\324\331i\323O\026\022\316\071W^\005\366H7K\357\314CW\357\216\360s\260\222o\363\244\062\303\335\024\315S\374Mr\214\232\346\nF\360V\032\326u\357\033O\247x\356\333\276\025F\224\314OA\202h\311\221\312\320&9\260\345\310\063\017\064`v\356z", dlen=0x7f10503ab254, scheme=0x7f105c1f5400, key_version=1, i32_1=0, i32_2=455, i64=18913978) at /home/jan/mysql/10.1-encryption/sql/encryption.cc:211 #10 0x00007f105241765e in fil_space_decrypt (crypt_data=0x7f105c1f5400, src_frame=0x7f1018004000 "\177\002\343\256", page_size=16384, dst_frame=0x7f1050e14000 "\177\002\343\256") at /home/jan/mysql/10.1-encryption/storage/innobase/fil/fil0crypt.cc:798 #11 0x00007f1052417772 in fil_space_decrypt (space=0, src_frame=0x7f1018004000 "\177\002\343\256", page_size=16384, dst_frame=0x7f1050e14000 "\177\002\343\256") at /home/jan/mysql/10.1-encryption/storage/innobase/fil/fil0crypt.cc:843 #12 0x00007f10523a289d in buf_page_decrypt_after_read (bpage=0x7f1050665b40) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:5881 #13 0x00007f105239ed99 in buf_page_io_complete (bpage=0x7f1050665b40, evict=false) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:4246 #14 0x00007f10523bb18d in buf_read_page_low (err=0x7f10503ab47c, sync=true, mode=132, space=0, zip_size=0, unzip=0, tablespace_version=1, offset=455) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0rea.cc:216 #15 0x00007f10523bb6b7 in buf_read_page (space=0, zip_size=0, offset=455) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0rea.cc:414 #16 0x00007f105239b47f in buf_page_get_gen (space=0, zip_size=0, offset=455, rw_latch=2, guess=0x0, mode=10, file=0x7f10526a9fa8 "/home/jan/mysql/10.1-encryption/storage/innobase/include/trx0undo.ic", line=171, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/buf/buf0buf.cc:2764 #17 0x00007f10525f7044 in trx_undo_page_get (space=0, zip_size=0, page_no=455, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/include/trx0undo.ic:170 #18 0x00007f10525fa640 in trx_undo_reuse_cached (trx=0x7f1020002888, rseg=0x7f105c2188d8, type=1, trx_id=27132, xid=0x7f1020002a18, mtr=0x7f10503ab670) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0undo.cc:1681 #19 0x00007f10525fa9bc in trx_undo_assign_undo (trx=0x7f1020002888, type=1) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0undo.cc:1785 #20 0x00007f10525e163c in trx_undo_report_row_operation (flags=0, op_type=1, thr=0x7f10201f0888, index=0x7f10201ef8a8, clust_entry=0x7f10201b0e98, update=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x7f10503ac168) at /home/jan/mysql/10.1-encryption/storage/innobase/trx/trx0rec.cc:1262 #21 0x00007f105236f11c in btr_cur_ins_lock_and_undo (flags=0, cursor=0x7f10503ac320, entry=0x7f10201b0e98, thr=0x7f10201f0888, mtr=0x7f10503ac3a0, inherit=0x7f10503ac1e0) at /home/jan/mysql/10.1-encryption/storage/innobase/btr/btr0cur.cc:1174 #22 0x00007f105236f761 in btr_cur_optimistic_insert (flags=0, cursor=0x7f10503ac320, offsets=0x7f10503ac2e0, heap=0x7f10503ac2f0, entry=0x7f10201b0e98, rec=0x7f10503ac2f8, big_rec=0x7f10503ac2e8, n_ext=0, thr=0x7f10201f0888, mtr=0x7f10503ac3a0) at /home/jan/mysql/10.1-encryption/storage/innobase/btr/btr0cur.cc:1394 #23 0x00007f1052550f8c in row_ins_clust_index_entry_low (flags=0, mode=2, index=0x7f10201ef8a8, n_uniq=0, entry=0x7f10201b0e98, n_ext=0, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2500 #24 0x00007f1052551fe4 in row_ins_clust_index_entry (index=0x7f10201ef8a8, entry=0x7f10201b0e98, thr=0x7f10201f0888, n_ext=0) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2896 #25 0x00007f10525522fb in row_ins_index_entry (index=0x7f10201ef8a8, entry=0x7f10201b0e98, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:2994 #26 0x00007f10525525bb in row_ins_index_entry_step (node=0x7f10201f0630, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3071 #27 0x00007f10525528cb in row_ins (node=0x7f10201f0630, thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3211 #28 0x00007f1052552c2c in row_ins_step (thr=0x7f10201f0888) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0ins.cc:3336 #29 0x00007f10525691d2 in row_insert_for_mysql (mysql_rec=0x7f10201ef298 "\375\004", prebuilt=0x7f10201f0118) at /home/jan/mysql/10.1-encryption/storage/innobase/row/row0mysql.cc:1372 #30 0x00007f1052465f88 in ha_innodb::write_row (this=0x7f10201e8958, record=0x7f10201ef298 "\375\004") at /home/jan/mysql/10.1-encryption/storage/innobase/handler/ha_innodb.cc:7874 #31 0x00007f1059f4c321 in handler::ha_write_row (this=0x7f10201e8958, buf=0x7f10201ef298 "\375\004") at /home/jan/mysql/10.1-encryption/sql/handler.cc:5871 #32 0x00007f1059cf5299 in write_record (thd=0x7f105c0b8a70, table=0x7f10201ee670, info=0x7f1020014a50) at /home/jan/mysql/10.1-encryption/sql/sql_insert.cc:1854 #33 0x00007f1059cf9d0e in select_insert::send_data (this=0x7f1020014a10, values=...) at /home/jan/mysql/10.1-encryption/sql/sql_insert.cc:3619 #34 0x00007f1059d7da6e in end_send (join=0x7f1020014af8, join_tab=0x7f10200177c8, end_of_records=false) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:19104 #35 0x00007f1059d7b881 in evaluate_join_record (join=0x7f1020014af8, join_tab=0x7f1020017480, error=0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:18208 #36 0x00007f1059d7b175 in sub_select (join=0x7f1020014af8, join_tab=0x7f1020017480, end_of_records=false) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:17983 #37 0x00007f1059d7a9c3 in do_select (join=0x7f1020014af8, fields=0x7f105c0bcff8, table=0x0, procedure=0x0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:17640 #38 0x00007f1059d55e48 in JOIN::exec_inner (this=0x7f1020014af8) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:3098 #39 0x00007f1059d53119 in JOIN::exec (this=0x7f1020014af8) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:2397 #40 0x00007f1059d566ec in mysql_select (thd=0x7f105c0b8a70, rref_pointer_array=0x7f105c0bd158, tables=0x7f1020014228, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f1020014a10, unit=0x7f105c0bc7f0, select_lex=0x7f105c0bcee0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:3326 #41 0x00007f1059d4c6c8 in handle_select (thd=0x7f105c0b8a70, lex=0x7f105c0bc728, result=0x7f1020014a10, setup_tables_done_option=0) at /home/jan/mysql/10.1-encryption/sql/sql_select.cc:373 #42 0x00007f1059d14d51 in mysql_execute_command (thd=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:3379 #43 0x00007f1059d20c5b in mysql_parse (thd=0x7f105c0b8a70, rawbuf=0x7f10200138e8 "CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`", length=83, parser_state=0x7f10503ae200) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:7161 #44 0x00007f1059d0fea8 in dispatch_command (command=COM_QUERY, thd=0x7f105c0b8a70, packet=0x7f105c0bf5d1 "CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`", packet_length=83) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:1462 #45 0x00007f1059d0ec83 in do_command (thd=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_parse.cc:1090 #46 0x00007f1059e3f9c9 in do_handle_one_connection (thd_arg=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_connect.cc:1347 #47 0x00007f1059e3f721 in handle_one_connection (arg=0x7f105c0b8a70) at /home/jan/mysql/10.1-encryption/sql/sql_connect.cc:1258 #48 0x00007f105a1f0eff in pfs_spawn_thread (arg=0x7f105c0c48b0) at /home/jan/mysql/10.1-encryption/storage/perfschema/pfs.cc:1860 #49 0x00007f1057d4f182 in start_thread (arg=0x7f10503af700) at pthread_create.c:312 #50 0x00007f105747247d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

            commit 3e55ef26d49a900782d2c2bb2c03470faed6ec9d
            Author: Jan Lindström <jan.lindstrom@mariadb.com>
            Date: Wed May 20 13:35:51 2015 +0300

            MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1

            Make sure that when we publish the crypt_data we access the
            memory cache of the tablespace crypt_data. Make sure that
            crypt_data is stored whenever it is really needed.

            All this is not yet enough in my opinion because:

            sql/encryption.cc has DBUG_ASSERT(scheme->type == 1) i.e.
            crypt_data->type == CRYPT_SCHEME_1

            However, for InnoDB point of view we have global crypt_data
            for every tablespace. When we change variables on crypt_data
            we take mutex. However, when we use crypt_data for
            encryption/decryption we use pointer to this global
            structure and no mutex to protect against changes on
            crypt_data.

            Tablespace encryption starts in fil_crypt_start_encrypting_space
            from crypt_data that has crypt_data->type = CRYPT_SCHEME_UNENCRYPTED
            and later we write page 0 CRYPT_SCHEME_1 and finally whe publish
            that to memory cache.

            jplindst Jan Lindström (Inactive) added a comment - commit 3e55ef26d49a900782d2c2bb2c03470faed6ec9d Author: Jan Lindström <jan.lindstrom@mariadb.com> Date: Wed May 20 13:35:51 2015 +0300 MDEV-8173 : InnoDB; Failing assertion: crypt_data->type == 1 Make sure that when we publish the crypt_data we access the memory cache of the tablespace crypt_data. Make sure that crypt_data is stored whenever it is really needed. All this is not yet enough in my opinion because: sql/encryption.cc has DBUG_ASSERT(scheme->type == 1) i.e. crypt_data->type == CRYPT_SCHEME_1 However, for InnoDB point of view we have global crypt_data for every tablespace. When we change variables on crypt_data we take mutex. However, when we use crypt_data for encryption/decryption we use pointer to this global structure and no mutex to protect against changes on crypt_data. Tablespace encryption starts in fil_crypt_start_encrypting_space from crypt_data that has crypt_data->type = CRYPT_SCHEME_UNENCRYPTED and later we write page 0 CRYPT_SCHEME_1 and finally whe publish that to memory cache.
            jplindst Jan Lindström (Inactive) added a comment - http://lists.askmonty.org/pipermail/commits/2015-May/007926.html

            This is current solution for this (see comments on sql/encryption.cc)

            jplindst Jan Lindström (Inactive) added a comment - This is current solution for this (see comments on sql/encryption.cc)

            People

              serg Sergei Golubchik
              jplindst Jan Lindström (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.