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

ALTER on Aria table with aria_encrypt_tables=ON without encryption plugin corrupts table

    XMLWordPrintable

Details

    Description

      Test 1, without partitioning

      SET GLOBAL ARIA_ENCRYPT_TABLES= 1;
      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=Aria;
      INSERT INTO t1 VALUES (1);
      --error 0,192
      ALTER TABLE t1 FORCE;
      CHECK TABLE t1 EXTENDED;
      INSERT INTO t1 (pk) VALUES (2);
       
      # Cleanup
      DROP TABLE t1;
      SET GLOBAL ARIA_ENCRYPT_TABLES= 0;
      

      10.2 b22285e4

      CHECK TABLE t1 EXTENDED;
      Table	Op	Msg_type	Msg_text
      test.t1	check	error	Failed to flush data or index file
      test.t1	check	error	Size of indexfile is: 8192         Expected: 16384
      test.t1	check	Error	Unknown key id 1. Can't continue!
      test.t1	check	error	Corrupt
      INSERT INTO t1 (pk) VALUES (2);
      bug.protocol1                            [ fail ]
              Test ended at 2021-01-21 19:10:42
       
      CURRENT_TEST: bug.protocol1
      mysqltest: At line 9: query 'INSERT INTO t1 (pk) VALUES (2)' failed: 192: failed to decrypt './test/t1'  rc: -1  dstlen: 0  size: 9
      

      Test 2, with partitioning

      --source include/have_partition.inc
       
      SET GLOBAL ARIA_ENCRYPT_TABLES= 1;
      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=Aria PARTITION BY HASH(pk);
      INSERT INTO t1 VALUES (1);
      --error 0,192
      ALTER TABLE t1 FORCE;
      CHECK TABLE t1 EXTENDED;
      INSERT INTO t1 (pk) VALUES (2);
       
      # Cleanup
      DROP TABLE t1;
      SET GLOBAL ARIA_ENCRYPT_TABLES= 0;
      

      10.2 b22285e4 non-debug

      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=Aria PARTITION BY HASH(pk);
      INSERT INTO t1 VALUES (1);
      ALTER TABLE t1 FORCE;
      CHECK TABLE t1 EXTENDED;
      Table	Op	Msg_type	Msg_text
      test.t1	check	warning	Table is marked as crashed
      test.t1	check	error	Size of indexfile is: 8192         Expected: 16384
      test.t1	check	error	Partition p0 returned error
      test.t1	check	error	Corrupt
      INSERT INTO t1 (pk) VALUES (2);
      DROP TABLE t1;
      

      10.2 b22285e4 debug

      2021-01-21 19:14:28 139971983902464 [ERROR] mysqld: Unknown key id 1. Can't continue!
      2021-01-21 19:14:28 139971983902464 [ERROR] mysqld: Unknown key id 1. Can't continue!
      2021-01-21 19:14:28 139971983902464 [ERROR] mysqld: Table './test/t1#P#p0' is marked as crashed and should be repaired
      2021-01-21 19:14:28 139971983902464 [ERROR] mysqld: Table 't1' is marked as crashed and should be repaired
      2021-01-21 19:14:28 139971983902464 [Warning] Recovering table: './test/t1'
      2021-01-21 19:14:28 139971983902464 [ERROR] mysqld: Unknown key id 1. Can't continue!
      mysqld: /data/src/10.2/sql/protocol.cc:599: void Protocol::end_statement(): Assertion `0' failed.
      210121 19:14:28 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4dc9cb4f36 in __GI___assert_fail (assertion=0x55f17c6274f0 "0", file=0x55f17c6271c0 "/data/src/10.2/sql/protocol.cc", line=599, function=0x55f17c627410 "void Protocol::end_statement()") at assert.c:101
      #8  0x000055f17baf6b53 in Protocol::end_statement (this=0x7f4da8001348) at /data/src/10.2/sql/protocol.cc:599
      #9  0x000055f17bbd4109 in dispatch_command (command=COM_QUERY, thd=0x7f4da8000d90, packet=0x7f4da8008b51 "INSERT INTO t1 (pk) VALUES (2)", packet_length=30, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:2385
      #10 0x000055f17bbd10fd in do_command (thd=0x7f4da8000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #11 0x000055f17bd2b872 in do_handle_one_connection (connect=0x55f17eaba920) at /data/src/10.2/sql/sql_connect.cc:1336
      #12 0x000055f17bd2b5d7 in handle_one_connection (arg=0x55f17eaba920) at /data/src/10.2/sql/sql_connect.cc:1241
      #13 0x000055f17c553bc4 in pfs_spawn_thread (arg=0x55f17ea9dcb0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #14 0x00007f4dca1c4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #15 0x00007f4dc9da0293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Test case 3, with partitioning, different location of ARIA_ENCRYPT_TABLES

      --source include/have_partition.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=Aria PARTITION BY HASH(pk);
      INSERT INTO t1 VALUES (1);
      SET GLOBAL ARIA_ENCRYPT_TABLES= 1;
      --error 0,192
      ALTER TABLE t1 FORCE;
      CHECK TABLE t1 EXTENDED;
      INSERT INTO t1 (pk) VALUES (2);
       
      # Cleanup
      DROP TABLE t1;
      SET GLOBAL ARIA_ENCRYPT_TABLES= 0;
      

      10.2 b22285e4

      2021-01-21 19:18:40 140068050495232 [ERROR] mysqld: Unknown key id 1. Can't continue!
      mysqld: /data/src/10.2/sql/sql_error.cc:380: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed.
      210121 19:18:40 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f64284f3f36 in __GI___assert_fail (assertion=0x564f30ef4c08 "!is_set() || (m_status == DA_OK_BULK && is_bulk_op())", file=0x564f30ef49f0 "/data/src/10.2/sql/sql_error.cc", line=380, function=0x564f30ef4bc0 "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:101
      #8  0x0000564f3045cd9f in Diagnostics_area::set_ok_status (this=0x7f6410005f40, affected_rows=1, last_insert_id=0, message=0x7f642264b6b0 "Records: 1  Duplicates: 0  Warnings: 1") at /data/src/10.2/sql/sql_error.cc:380
      #9  0x0000564f3040e5c3 in my_ok (thd=0x7f6410000d90, affected_rows=1, id=0, message=0x7f642264b6b0 "Records: 1  Duplicates: 0  Warnings: 1") at /data/src/10.2/sql/sql_class.h:4568
      #10 0x0000564f305665c2 in mysql_alter_table (thd=0x7f6410000d90, new_db=0x7f6410012de0 "test", new_name=0x0, create_info=0x7f642264c290, table_list=0x7f64100127c8, alter_info=0x7f642264c1e0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9923
      #11 0x0000564f305e3e7c in Sql_cmd_alter_table::execute (this=0x7f6410012de8, thd=0x7f6410000d90) at /data/src/10.2/sql/sql_alter.cc:333
      #12 0x0000564f30492311 in mysql_execute_command (thd=0x7f6410000d90) at /data/src/10.2/sql/sql_parse.cc:5994
      #13 0x0000564f30497329 in mysql_parse (thd=0x7f6410000d90, rawbuf=0x7f64100126f8 "ALTER TABLE t1 FORCE", length=20, parser_state=0x7f642264d5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7763
      #14 0x0000564f30485602 in dispatch_command (command=COM_QUERY, thd=0x7f6410000d90, packet=0x7f6410008b51 "", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #15 0x0000564f304840fd in do_command (thd=0x7f6410000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #16 0x0000564f305de872 in do_handle_one_connection (connect=0x564f3295c920) at /data/src/10.2/sql/sql_connect.cc:1336
      #17 0x0000564f305de5d7 in handle_one_connection (arg=0x564f3295c920) at /data/src/10.2/sql/sql_connect.cc:1241
      #18 0x0000564f30e06bc4 in pfs_spawn_thread (arg=0x564f3293fcb0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #19 0x00007f6428a03609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #20 0x00007f64285df293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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