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

Assertion `rc == 0' failed in ma_encrypt on dropping an encrypted Aria table

Details

    Description

      --source include/have_file_key_management_plugin.inc
       
      SET GLOBAL aria_encrypt_tables = 1;
       
      CREATE TABLE t1 (i INT, KEY(i)) ENGINE=Aria;
      INSERT INTO t1 VALUES (1);
      DROP TABLE t1;

      mysqld: 10.1/storage/maria/ma_crypt.c:432: ma_encrypt: Assertion `rc == 0' failed.
      150420  0:15:01 [ERROR] mysqld got signal 6 ;

      Stack trace from 10.1 commit 22a7b4de

      #6  0x00007f4081916311 in *__GI___assert_fail (assertion=0x7f4084daf87c "rc == 0", file=<optimized out>, line=432, function=0x7f4084daf8d3 "ma_encrypt") at assert.c:81
      #7  0x00007f408497a017 in ma_encrypt (crypt_data=0x7f40789a82b0, src=0x7f407b004085 "\001", dst=0x7f4078aab085 "\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245\245"..., size=10, pageno=1, lsn=4294976107, key_version=0x7f4083ca8a94) at 10.1/storage/maria/ma_crypt.c:432
      #8  0x00007f4084979e3d in ma_crypt_index_pre_write_hook (args=0x7f4083ca8b40) at 10.1/storage/maria/ma_crypt.c:384
      #9  0x00007f408496186f in pagecache_fwrite (pagecache=0x7f4085d9f200, filedesc=0x7f407cea9488, buffer=0x7f407b004070 "\001", pageno=1, type=PAGECACHE_LSN_PAGE, flags=36) at 10.1/storage/maria/ma_pagecache.c:664
      #10 0x00007f408496b119 in flush_cached_blocks (pagecache=0x7f4085d9f200, file=0x7f40789586e8, cache=0x7f4083ca8d60, end=0x7f4083ca8d68, type=FLUSH_RELEASE, first_errno=0x7f4083ca8cc4) at 10.1/storage/maria/ma_pagecache.c:4399
      #11 0x00007f408496ba67 in flush_pagecache_blocks_int (pagecache=0x7f4085d9f200, file=0x7f40789586e8, type=FLUSH_RELEASE, filter=0, filter_arg=0x0) at 10.1/storage/maria/ma_pagecache.c:4688
      #12 0x00007f408496be66 in flush_pagecache_blocks_with_filter (pagecache=0x7f4085d9f200, file=0x7f40789586e8, type=FLUSH_RELEASE, filter=0, filter_arg=0x0) at 10.1/storage/maria/ma_pagecache.c:4804
      #13 0x00007f40849cc354 in maria_close (info=0x7f4078974070) at 10.1/storage/maria/ma_close.c:47
      #14 0x00007f408493f070 in ha_maria::close (this=0x7f40788b6888) at 10.1/storage/maria/ha_maria.cc:1263
      #15 0x00007f4084475d48 in handler::ha_close (this=0x7f40788b6888) at 10.1/sql/handler.cc:2575
      #16 0x00007f408432dc64 in closefrm (table=0x7f4078888c70, free_share=true) at 10.1/sql/table.cc:3009
      #17 0x00007f40841d772c in intern_close_table (table=0x7f4078888c70) at 10.1/sql/sql_base.cc:359
      #18 0x00007f40843fc810 in tdc_remove_table (thd=0x7f407aa5b070, remove_type=TDC_RT_REMOVE_ALL, db=0x7f4078806730 "test", table_name=0x7f4078806118 "t1", kill_delayed_threads=false) at 10.1/sql/table_cache.cc:917
      #19 0x00007f40842f363b in mysql_rm_table_no_locks (thd=0x7f407aa5b070, tables=0x7f4078806150, if_exists=false, drop_temporary=false, drop_view=false, dont_log_query=false, dont_free_locks=false) at 10.1/sql/sql_table.cc:2462
      #20 0x00007f40842f292d in mysql_rm_table (thd=0x7f407aa5b070, tables=0x7f4078806150, if_exists=0 '\000', drop_temporary=0 '\000') at 10.1/sql/sql_table.cc:2085
      #21 0x00007f408424693f in mysql_execute_command (thd=0x7f407aa5b070) at 10.1/sql/sql_parse.cc:4147
      #22 0x00007f408425002e in mysql_parse (thd=0x7f407aa5b070, rawbuf=0x7f4078806088 "DROP TABLE t1", length=13, parser_state=0x7f4083cae1b0) at 10.1/sql/sql_parse.cc:7165
      #23 0x00007f408423f03e in dispatch_command (command=COM_QUERY, thd=0x7f407aa5b070, packet=0x7f407eff3071 "DROP TABLE t1", packet_length=13) at 10.1/sql/sql_parse.cc:1462
      #24 0x00007f408423de0e in do_command (thd=0x7f407aa5b070) at 10.1/sql/sql_parse.cc:1090
      #25 0x00007f408436f0a7 in do_handle_one_connection (thd_arg=0x7f407aa5b070) at 10.1/sql/sql_connect.cc:1347
      #26 0x00007f408436edec in handle_one_connection (arg=0x7f407aa5b070) at 10.1/sql/sql_connect.cc:1258
      #27 0x00007f4084923f46 in pfs_spawn_thread (arg=0x7f4081023870) at 10.1/storage/perfschema/pfs.cc:1860
      #28 0x00007f4083931b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #29 0x00007f40819c695d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      On a release build, a warning is produced:

      MariaDB [test]> DROP TABLE t1;
      Query OK, 0 rows affected, 1 warning (0.01 sec)
       
      MariaDB [test]> show warnings;
      +-------+------+------------------------------------------------+
      | Level | Code | Message                                        |
      +-------+------+------------------------------------------------+
      | Error |  168 | failed to encrypt! rc: -1, dstlen: 0 size: 10
       |
      +-------+------+------------------------------------------------+
      1 row in set (0.00 sec)

      Attachments

        Activity

          This is related to encrypting of the last partial block. In this case the whole string to encrypt is less than one block.

          serg Sergei Golubchik added a comment - This is related to encrypting of the last partial block. In this case the whole string to encrypt is less than one block.

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.